Exchange Grails Server Configuration

I am trying to configure mail on an Exchange server.

This is my configuration.

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" ] } } 

I get the following error

 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; 

I know that this is a problem with props, which I have to change, since this configuration works in my mail application. I know that the port is correct, it uses SSL.

I also tried to use these details

  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"] 

Debugging will result in the following:

 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 
+7
email smtp grails
source share
2 answers

It looks like a certificate issue. If you have access to a server that does not use SSL, I would first test it, otherwise you need to:

  • Find a certificate provider (if you do not know this, you can use openssl verify http://www.herongyang.com/Cryptography/OpenSSL-Certificate-Path-Validation-Tests.html )
  • See CA in your java repository
    • Find either the default java key store ( How do I know which store my JVM uses? ) Or the one you use
    • List the keystore and find the appropriate CA
    • If there is a CA, then the problem is unlikely to be this
    • If there is no corresponding CA, then get the CA certificate and import it into the keystore, restart the server and earn again.
0
source share

I had the same problem. If you are trying to access the exchange server on the network (organization), I consider that the port number is the problem. This can be changed by the network administrator.

Contact your network administrator and explain to him that you are trying to access the Exchange server and require a username, password and corresponding port number. Authentication may not be necessary if the application is launched internally, i.e.

props = ["mail.smtp.auth":"false"]

Hope this helps.

0
source share

All Articles