如题,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)

解决方案 »

  1.   

    Email email = Email.create()
    .from("[email protected]")
    .to("[email protected]")
    .subject("test")
    .addText("ab你好!cd")
    .addHtml("<html><META http-equiv=Content-Type content=\"text/html; charset=utf-8\">" +
     "<body><h1>你好v</h1></body></html>")
    .embedFile("d:\\huh2.jpg")
    .attachFile("d:\\cover.jpg");
    SendMailSession mailSession = new SmtpSslServer("smtp.163.com","[email protected]", "password").createSession();
    mailSession.open();
    mailSession.sendMail(email);
    mailSession.close();
    System.out.println("发送成功!...");
      

  2.   

    SendMailSession mailSession = new SmtpSslServer("smtp.163.com","[email protected]", "password").createSession();
    [email protected]改为user
      

  3.   

    试了下你上面的代码,没啥问题。呵呵。454并不是指端口号,提示的错误说的是SMTP服务器返回了一个提示,当TLS激活的时候(你用了SslServer),你给的某个Command命令是不能执行的。可以试试看用new SmtpServer()