Dear Umesh Sonavane,
         I am  just ok for send mail on internet used Java Mail API.
I'll bet  we need  a smtp server or to make a smtp-host point to
one of smtp server  which we can be used on the Internet.   
Orion dosen't  has the smtp server implementation I think.
 
         These are my step and I successfully run sample code t
o send mail on internet. In the sample codes I used Java Mail API. 
I hope that the sample codes can help you.
         First, find a smtp server on internet that you can use.
and you can use "Ping   XXX.XXX.XXX"  command to ping it
that assure you can use it in you side.
        And then you can use your or my sample code to send
Mail on internet.
        GOOD LUCK! from yours Urey but remember when you
success Please let me know to share your enjoyments.
See you later. 
       
> import java.util.*;
> import java.io.*;
> import javax.mail.*;
> import javax.mail.internet.*;
> import javax.activation.*;
>
> public class msgsendsample {
>
>    
file://@author Urey 12.14.2000   
>     private String host ="";
>     private String port ="";
>     private String protocol ="";
>
>     private String user     ="";
>     private String passWord ="";
>
>     private String from     ="";
>     private String to       ="";
>     private String subject  ="";
>     private String msgText  ="";
>     private String fileList ="";
>     private Session   session   =null;
>     private Transport transport =null;
>
>    public void setUser(String _host,String _port,String _protocol, String _user, String _passWord)
>    {
>     this.host     = _host;
>     this.port     = _port;
>     this.user     = _user;
>     this.passWord = _passWord;
>     this.protocol = _protocol;
>    }
>   
>     public void setMsg(String _from,String _to,String _subject, String _msgText)
>     {
>     this.from = _from;
>     this.to   = _to;
>     this.subject= _subject;
>     this.msgText= _msgText;
>     }
>    
>    public void sendMsg ()
>    {
> Properties props = new Properties();
> props.put("mail.smtp.host", host);
> session = Session.getDefaultInstance(props, null);
>
> try {
>     // create a message
>     Message msg = new MimeMessage(session);
>     InternetAddress[] address = {new InternetAddress(to)};
>    
>     msg.setFrom(new InternetAddress(from));
>     msg.setRecipients(Message.RecipientType.TO, address);
>     msg.setSubject(subject);
>     msg.setSentDate(new Date());
>     msg.setText(msgText);
>    
>    
file://send msg
>     transport = session.getTransport(protocol);
>     transport.connect(host, Integer.parseInt(port), user, passWord);
>     Transport.send(msg,address);
>    
> } catch (MessagingException mex) {
>     errors(mex);
> }
>    }
>   
>   
>    private void errors(MessagingException mex)
>    {
>     System.out.println("\n--Exception handling in msgsendsample.java");
>
>     mex.printStackTrace();
>     System.out.println();
>     Exception ex = mex;
>     do {
> if (ex instanceof SendFailedException) {
>     SendFailedException sfex = (SendFailedException)ex;
>     Address[] invalid = sfex.getInvalidAddresses();
>     if (invalid != null) {
> System.out.println("    ** Invalid Addresses");
> if (invalid != null) {
>     for (int i = 0; i < invalid.length; i++)
> System.out.println("         " + invalid[i]);
> }
>     }
>     Address[] validUnsent = sfex.getValidUnsentAddresses();
>     if (validUnsent != null) {
> System.out.println("    ** ValidUnsent Addresses");
> if (validUnsent != null) {
>     for (int i = 0; i < validUnsent.length; i++)
> System.out.println("         "+validUnsent[i]);
> }
>     }
>     Address[] validSent = sfex.getValidSentAddresses();
>     if (validSent != null) {
> System.out.println("    ** ValidSent Addresses");
> if (validSent != null) {
>     for (int i = 0; i < validSent.length; i++)
> System.out.println("         "+validSent[i]);
> }
>     }
> }
> System.out.println();
> if (ex instanceof MessagingException)
>     ex = ((MessagingException)ex).getNextException();
> else
>     ex = null;
>     } while (ex != null);
>    }
> }
>
>
 
 
 
----- Original Message -----
Sent: Thursday, December 14, 2000 5:50 PM
Subject: from orion-interest

Hi Urey   
 
I am writing a EJB for mailing
the EJB is Stateless Session Bean and it is been called from servlets
I am using orion 1.3.8 under windows98 platform
i am having problems with the same
what setting i have to do for making the mailing ejb run
like what should be the application.xml setting
I have the following setting in my application.xml
 
 <mail-session location="mail/MailSession" smtp-host="smtp-server.cox.rr.com">
  <property name="mail.transport.protocol" value="smtp" />
  <property name="mail.smtp.from" value="[EMAIL PROTECTED]" />
  <property name="mail.from" value="[EMAIL PROTECTED]" />
 </mail-session>
In the smtp-host what i have to put and is there any other setting that i have to do
and does orion has a smtp server implementation or i have to make the smtp-host point to the smtp server
 
please help its urgent
 
 
Umesh Sonavane

Reply via email to