dcsimg
send mail error:Could not connect to SMTP host
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   wu_qihua
Posted On:   Friday, August 2, 2002 11:23 PM

the snippet is: Properties props=new Properties(); props.setProperty("mail.smtp.host","hotmail.com"); session ms=Session.getInstance(props); try{ Message msg=new MimeMessage(ms); msg.setFrom(new InternetAddress("wqhhust1@sina.com")); msg.setSentDate(new Date()); msg.setSubject("this is the mail program"); msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("wqh_flp@hotmail.com")); msg.setText("hello"); Transport.send(msg); System.out.println("send ok"); }catch(Exception e){ e.printStackTrace(); } the error message: javax.m   More>>

the snippet is:
Properties props=new Properties();
props.setProperty("mail.smtp.host","hotmail.com");
session ms=Session.getInstance(props);
try{
Message msg=new MimeMessage(ms);
msg.setFrom(new InternetAddress("wqhhust1@sina.com"));
msg.setSentDate(new Date());
msg.setSubject("this is the mail program");
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("wqh_flp@hotmail.com"));
msg.setText("hello");

Transport.send(msg);
System.out.println("send ok");
}catch(Exception e){
e.printStackTrace();
}


the error message:

javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: Could not connect to SMTP host: hotmail.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at test.Mymail.main(Mymail.java:37)


what is the problem

   <<Less

Re: send mail error:Could not connect to SMTP host

Posted By:   Anil_Hemnani  
Posted On:   Monday, August 5, 2002 03:44 AM

Hotmail.com may not have SMTP Server running on port 25. Try to find the MX Record of Hotmail and use that IP Address of MX Record instead of hotmail.com. It will definately work.

Re: send mail error:Could not connect to SMTP host

Posted By:   John_Zukowski  
Posted On:   Saturday, August 3, 2002 12:41 PM

To the best of my knowledge, hotmail.com isn't an SMTP server.
About | Sitemap | Contact