Grails邮件Exchange服务器配置

Dan*_*y Y 7 email grails smtp

我正在尝试使用Exchange服务器配置邮件.

这是我的配置

grails {
    mail {
        host = "mail.xxx.xx.xx"
        port = 443
        username = "username"
        password = "password"
        props = [   "mail.smtp.auth":"true",
                    "mail.smtp.port":"443",
                    "mail.smtp.ssl.enable" :"true"
                 ]
    }
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

Message: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response;
  nested exception is:
    java.net.SocketException: Connection reset. Failed messages: javax.mail.MessagingException: Exception reading response;
Run Code Online (Sandbox Code Playgroud)

我知道这是我必须更改道具的问题,因为此配置适用于我的邮件应用程序.我知道端口是正确的,它使用SSL.

我也尝试过使用这些道具

    props = ["mail.smtp.timeout"               : "100000",
             "mail.smtp.starttls.enable"       : "true",
             "mail.smtp.EnableSSL.enable"      : "true",
             "mail.transport.protocol"         : "smtps",
             "mail.smtp.socketFactory.port"    : "443",
             "mail.smtp.auth"                  : "true",
             "mail.smtp.socketFactory.class"   : "javax.net.ssl.SSLSocketFactory",
             "mail.smtp.socketFactory.fallback": "false",
             "mail.debug"                      : "true"]
Run Code Online (Sandbox Code Playgroud)

调试结果如下:

DEBUG: JavaMail version 1.5.1
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "xxx.xxx.xx.xx", port 443, isSSL true
Run Code Online (Sandbox Code Playgroud)

esa*_*uro 0

在我看来这是一个证书问题。如果您可以访问不使用 SSL 的服务器,我会首先进行测试,否则您应该: