0

我们正在使用自己的邮件服务器在我们的应用程序中配置电子邮件服务器,但是在发送邮件时我遇到了这个异常。

  host = "mail.xxx.com"
  port = 25
  username = "xx@xx.com"
  password = "xx"
  props = ["mail.smtp.auth":"true",
            "mail.smtp.socketFactory.port":"25",
            "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
            "mail.smtp.socketFactory.fallback":"false"]

 org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: mail.co-optimum.com, port: 25;
  nested exception is:
    javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: mail.co-optimum.com, port: 25;
  nested exception is:
    javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?; message exceptions (1) are:
Failed message 1: javax.mail.MessagingException: Could not connect to SMTP host: mail.co-optimum.com, port: 25;
  nested exception is:
    javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection

?

4

2 回答 2

1

我看到发生这种情况的前三个原因是由于以下几点:

  1. 由于安全策略,应用服务器上的 TCP 端口被阻止
  2. 由于安全策略,TCP 端口被防火墙或其他网络设备阻止
  3. 目标 SMTP 服务器要求您将应用程序服务器“列入白名单”以允许连接。

所有这三种情况的发生都是因为一家公司希望防止垃圾邮件发送者使用他们的电子邮件服务器有垃圾邮件递送系统。

与您的支持人员交谈。

希望有帮助...

于 2012-10-02T03:59:02.050 回答
0

从 Exception 看来,服务器在 25 上似乎无法正常工作。

首先尝试通过 telnet 发送邮件,以确保邮件服务器正常工作。

  • 如果 mailfrom 的域不是邮件服务器域

    1. the domain of rcptto is not mail server domain,

      the mail server should deny it, because it can be generate many spam mail.

    2. the domain of rcptto is mail server domain,

      no problem

  • the domain of mailfrom is mail server domain,

    you must do auth-login (I think it is your problem).

If you use javamail, props.put("mail.smtp.auth", "true"); and create session with Authenticator.

于 2012-10-02T04:02:13.873 回答