JDAVMail 发送Hotmail 异常

lljava2007 发布于 2013/01/14 10:44
阅读 390
收藏 0

我用  JDAVMail,JavaMail 发送 hotmail邮件,我的代码如下:

 try {
 Properties prop = new Properties(); 
 prop.setProperty("mail.davmail.from","hot2012_6@hotmail.com"); 
 Session ses = Session.getInstance(prop); 
  Transport transport = ses.getTransport("davmail_xmit"); 
  transport.connect("smtp.live.com", "hot2012_6@hotmail.com","www123456"); 
 MimeMessage txMsg = new MimeMessage(ses);
 txMsg.setSubject("This is the subject");
 InternetAddress addrFrom = new InternetAddress("hot2012_6@hotmail.com");
 txMsg.setFrom(addrFrom);
 InternetAddress addrTo = new InternetAddress("23081374@qq.com");
 txMsg.addRecipient(Message.RecipientType.TO, addrTo);
 txMsg.setText("Hello world !");
 txMsg.setSentDate(new Date());
 transport.sendMessage(txMsg, txMsg.getAllRecipients());
 } catch (Exception ex) {
 ex.printStackTrace();
 }

执行后抛出如下异常,不知道是什么原因,希望哪位高人能帮帮我???

javax.mail.MessagingException: protocolConnect exception;
  nested exception is:
 java.net.ConnectException: Connection timed out: connect
 at com.posisoft.jdavmail.JDAVMailService.protocolConnect(JDAVMailService.java:179)
 at com.posisoft.jdavmail.JDAVMailTransport.protocolConnect(JDAVMailTransport.java:76)
 at javax.mail.Service.connect(Service.java:291)
 at javax.mail.Service.connect(Service.java:172)
 at mail.hotmail.Hotmail.send(Hotmail.java:41)
 at mail.hotmail.Hotmail.main(Hotmail.java:66)
Caused by: java.net.ConnectException: Connection timed out: connect
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
加载中
0
红薯
红薯
我记得 hotmail 好像已经关闭此项服务了哦
返回顶部
顶部