struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: urgent- exception in sending e-mail from application
Date Fri, 16 Jun 2006 06:18:01 GMT

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" <> 
06/16/2006 10:36 AM
Please respond to
"Struts Users Mailing List" <>

"Struts Users Mailing List" <>

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 ("","smtp host name");
            Session session = Session.getDefaultInstance
            Message message = new MimeMessage (session);
                message.setFrom (new InternetAddress
                message.setRecipient (Message.RecipientType.TO,new
InternetAddress (""));
                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:, port: 25
is there any additional setting's required for this one
plse let me know 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message