如题,jodd 发送邮件 使用stmp.qq.com 没有问题,但是stmp.163.com就是发不出去!
报错为,说是stmp的454端口不通,但是stmp用的默认端口是465哇,我真的很奇怪。 求jodd高手解答
错误为:
Exception in thread "main" jodd.mail.MailException: Unable to connect; <--- javax.mail.MessagingException: 454 Command not permitted when TLS active
at jodd.mail.SendMailSession.open(SendMailSession.java:46)
at common.utils.EmailTest.sendMailBySTMP163(EmailTest.java:78)
at common.utils.EmailTest.main(EmailTest.java:40)
Caused by: javax.mail.MessagingException: 454 Command not permitted when TLS active
at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1795)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1644)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:534)
at javax.mail.Service.connect(Service.java:313)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at jodd.mail.SendMailSession.open(SendMailSession.java:44)
... 2 more
---[cause]------------------------------------
javax.mail.MessagingException: 454 Command not permitted when TLS active
at com.sun.mail.smtp.SMTPTransport.issueCommand(SMTPTransport.java:1795)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1644)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:534)
at javax.mail.Service.connect(Service.java:313)
at javax.mail.Service.connect(Service.java:172)
at javax.mail.Service.connect(Service.java:121)
at jodd.mail.SendMailSession.open(SendMailSession.java:44)
at common.utils.EmailTest.sendMailBySTMP163(EmailTest.java:78)
at common.utils.EmailTest.main(EmailTest.java:40)
------解决方案--------------------
163改了配置你上163找找,这些网络邮箱好像多有各自独特的配置
------解决方案--------------------
SendMailSession mailSession = new SmtpSslServer("smtp.163.com","user@163.com", "password").createSession();
user@163.com改为user
------解决方案--------------------
试了下你上面的代码,没啥问题。呵呵。
454并不是指端口号,提示的错误说的是SMTP服务器返回了一个提示,当TLS激活的时候(你用了SslServer),你给的某个Command命令是不能执行的。
可以试试看用new SmtpServer()
------解决方案--------------------
一般发邮件的功能,公司都有自己的服务器,
要想用人家的服务器发邮件,就得按人家的规定来,
你应该先去了解163服务器的配置