Sheetal,

I think problem is with the port number only. Default port would always be 
25 for the mail server and you are not specifying the any specific port 
number in your program it means it will pick the default port number but 
you should first check it with your network people that mail server uses 
the default port i.e. 25 or some other port. If some other port then set 
the port number also in your program.

Check it, I think it will definitely wotk for you.

Thanks & Regards
Sunil Sahu
Sr. Software Engineer
Ph. +91-124-4047100 Ext. 752




"Patil, Sheetal" <[EMAIL PROTECTED]> 
06/16/2006 10:36 AM
Please respond to
"Struts Users Mailing List" <user@struts.apache.org>


To
"Struts Users Mailing List" <user@struts.apache.org>
cc

Subject
urgent- exception in sending e-mail from application







Hello friends
I am trying to send mail from my application
Here is the code
            Properties properties = System.getProperties ();
            properties.put ("mail.smtp.host","smtp host name");
 
            Session session = Session.getDefaultInstance
(properties,null);
 
            Message message = new MimeMessage (session);
            try
            {
                message.setFrom (new InternetAddress
("[EMAIL PROTECTED]"));
                message.setRecipient (Message.RecipientType.TO,new
InternetAddress ("[EMAIL PROTECTED]"));
                message.setSubject ("Hi ");
                message.setText ("How is it going ?");
                message.setSentDate (new Date ());
                Transport.send (message);
                System.out.println ("Message sent !!!");
            }
            catch (MessagingException e)
            {
                e.printStackTrace ();
            }

But this code is giving me exception 
javax.mail.MessagingException: Could not connect to SMTP host:
usncex10.ad.diebold.com, port: 25
is there any additional setting's required for this one
plse let me know 
Sp


Reply via email to