JDAVMail 发送Hotmail 异常
我用 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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我记得 hotmail 好像已经关闭此项服务了哦