Closed ujjwol05 closed 7 years ago
It says, that it fails to connect to smtp.gmail.com
on port 465
. This is not a but in the mail plugin, but rather some connection issue on your localhost.
and by the way, it is not recommended to use closures as action definitions in Grails 2.x and up. You should change it to methods instead.
@sbglasius well I have another project that uses mail 1.0.7 on grails 2.4.2 and it's working fine. mail-2.0.0.RC6 on grails 3.1.0 gives me the error on the same config
You should try and convert your mail settings to application.groovy
and use the old format. I'm not sure that the props:
section gets passed back to the mail plugin correctly using application.yml
I even tried that one too.My config on application.groovy
grails {
mail {
host = "smtp.gmail.com"
port = 465
username = "*********@gmail.com"
password = "*********"
props = ["mail.smtp.auth":"true",
"mail.smtp.socketFactory.port":"465",
"mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
"mail.smtp.socketFactory.fallback":"false"]
}
}
And the error is same
ERROR org.grails.web.errors.GrailsExceptionResolver - MessagingException occurred when processing request: [GET] /ims/test/create
Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1. Stacktrace follows:
org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
at grails.plugins.mail.MailMessageBuilder.sendMessage(MailMessageBuilder.groovy:130) ~[mail-2.0.0.RC6.jar:na]
at grails.plugins.mail.MailService.sendMail(MailService.groovy:53) ~[mail-2.0.0.RC6.jar:na]
at grails.plugins.mail.MailService.sendMail(MailService.groovy:57) ~[mail-2.0.0.RC6.jar:na]
at ims.TestController.create(TestController.groovy:17) ~[main/:na]
at grails.plugin.springsecurity.web.UpdateRequestContextHolderExceptionTranslationFilter.doFilter(UpdateRequestContextHolderExceptionTranslationFilter.groovy:64) ~[spring-security-core-3.1.1.jar:na]
at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.groovy:53) ~[spring-security-core-3.1.1.jar:na]
at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.groovy:62) ~[spring-security-core-3.1.1.jar:na]
at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.groovy:58) ~[spring-security-core-3.1.1.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0]
at java.lang.Thread.run(Thread.java:744) [na:1.8.0]
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2042) ~[javax.mail-1.5.4.jar:1.5.4]
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697) ~[javax.mail-1.5.4.jar:1.5.4]
at javax.mail.Service.connect(Service.java:364) ~[javax.mail-api-1.5.4.jar:1.5.4]
... 11 common frames omitted
This example works: https://github.com/sbglasius/g3-tour-de-plugin-demo/blob/mail/grails-app/conf/application.groovy (notice, that it's on the tag mail
)
The presentation is here: https://www.youtube.com/watch?v=RuK90qD6RJU
Notice, that the password
in my example is set in an external file.
@sbglasius Today i tried the plugin for grails 3.0.2 and everything is working fine. I guess there is a issue for grails 3.1.0 . I tried installing the plugin several times but still the error is same. Which version of grails did you use for the presentation?
I used Grails 3.2.3
Thanks . It worked on other grails version . But there is a issue for 3.1.0
Action
ERROR