新浪邮箱成功
自己公司的却是失败
不知道为什么连不上
foxmail可以发送
配置如下
mail.HostName=smtp.fang.com
mail.SmtpPort=22
mail.UserName=zhangfan
mail.Password=
mail.SSLOnConnect=false
mail.From=zhangfan@fang.com
mail.charset=UTF-8
错误日志如下
log4j:WARN No such property [append] in org.apache.log4j.ConsoleAppender.
2017-01-09 11:03:43 [ main:1 ] - [ INFO ] send email fail
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.fang.com:22
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1410)
at org.cobweb.bridge.mail.impl.HtmlEmailServiceImpl.send(HtmlEmailServiceImpl.java:74)
at org.cobweb.bridge.mail.impl.HtmlEmailServiceImpl.main(HtmlEmailServiceImpl.java:91)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.fang.com, port: 22;
nested exception is:
java.net.ConnectException: Connection refused: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
at javax.mail.Service.connect(Service.java:317)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1400)
... 2 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:317)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:233)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1938)
... 9 more
2017-01-09 11:03:43 [ main:5 ] - [ INFO ] 发送邮件失败