NutzCN Logo
问答 邮件发送问题,使用公司邮箱发送失败
发布于 258天前 作者 哎呦哥哥 269 次浏览 复制 上一个帖子 下一个帖子
标签: email

新浪邮箱成功
自己公司的却是失败
不知道为什么连不上
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 ]  发送邮件失败
11 回复

foxmail中的设置是这么的

发件服务器:smtp.fang.com SSL 端口:25

mail.SmtpPort=25

foxmail中的设置是这么的

发件服务器:smtp.fang.com  <input type="checkbox" checked="fasle"/> SSL 端口:25

@wendal mail.SmtpPort=25或者465 都不好使

@qq_999005dc 你写的是22,报错信息也是22

@wendal 哈哈,这是个事物,这个改正了 25 换了个错误

2017-01-09 11:17:12  [ main:1 ] - [ INFO ]  send email fail
org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.fang.com:25
	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.AuthenticationFailedException: 535 authentication failed (#5.7.1) (eYou MTA)

	at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:823)
	at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:756)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:673)
	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
2017-01-09 11:17:12  [ main:4 ] - [ INFO ]  发送邮件失败

这是授权失败了,密码写错了吧

@wendal 密码应该不会错 找到的解决办法 也在说密码之类的 换了同事的 貌似也是这样 我再试试

@qq_999005dc 要不先试试阿里云邮?

谢谢,可以的,这里就是想试试公司的邮箱,没想到不成,待会问下带我的 为什么验证失败吧

添加回复
请先登陆
回到顶部