项目中直接写了个发邮件的东东
测试环境下一切正常,一放到公网就出错,错误信息:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;
nested exception is:
java.net.SocketException: Software caused connection abort: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1008)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:197)
at javax.mail.Service.connect(Service.java:233)
at javax.mail.Service.connect(Service.java:134)
at Foo.main(Foo.java:51)
原因:
邮件端口(port 25)与杀毒软件McAfee冲突,关掉McAfee就可以发送成功拉