使用grails async mail api发送邮件时“无法识别的SSL消息,明文连接”

时间:2014-04-04 08:14:11

标签: grails asynchronous

我正在尝试使用Grails Async Mail API

发送邮件

当我使用以下配置尝试使用Gmail时:

grails {
   mail {
      host = "smtp.gmail.com"
      port = 465
      username = "xxxx@gmail.com"
      password = "xxxx"
      props = ["mail.smtp.auth":"true",                        
               "mail.smtp.socketFactory.port":"465",
               "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
               "mail.smtp.socketFactory.fallback":"false"]
   }
}

config.groovy 中,我能够发送邮件。当我更改特定邮件服务器的上述配置时,如下所示:

grails {
  mail {
    host = "xxx"
    port = 25
    username = "xxx"
    props = ["mail.smtp.auth":"false",
             "mail.smtp.socketFactory.port":"25",                           
             "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
             "mail.smtp.socketFactory.fallback":"true",
             "mail.smtp.starttls.enable": "false",
             "mail.smtp.starttls.required": "false"]
  }
}

我收到以下错误:

javax.mail.MessagingException: Could not connect to SMTP host: xxx, port: 25;
  nested exception is:
    javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

请给我一些提示,在上述情况下我做错了什么。

1 个答案:

答案 0 :(得分:2)

你可以尝试简单地跟随,它应该适合你

grails {
  mail {
    host = "xxx"
    port = 25
    username = "xxx"
    props = ["mail.smtp.auth":"false",
             "mail.smtp.socketFactory.port":"25",                           
             "mail.smtp.starttls.enable": "true"]
  }
}