Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grails mail connection refused

it seems i have tried the mail config in the way that its docs said, but still i get:

Error 500: Executing action [x] of controller [x] caused exception: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP 

I am using google apps for my email - [email protected] is using gmail. i cannot get grails to send out a test message on my dev box (win 7).

my config is:

   host = "smtp.gmail.com"
   port = 465
   username = "[email protected]"
   password = "x"
   props = ["mail.smtp.auth":"true",
            "mail.smtp.debug":"true",
            "mail.smtp.starttls.enable":"true",
            "mail.smtp.socketFactory.port":"465",
            "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
            "mail.smtp.socketFactory.fallback":"false"]

edit: do i need to have some sort of a signed key to support ssl connection to gmail?

like image 245
mkoryak Avatar asked Dec 17 '25 16:12

mkoryak


1 Answers

Try the following:

props = ["mail.transport.protocol":"smtps",
         "mail.smtps.host":"smtp.gmail.com",
         "mail.smtps.port":"465",
         "mail.smtps.auth":"true"]

That seems to be the standard set of params necessary to connect to Google's SMTP server. The key thing is to use smtps instead of smtp plus TLS.

like image 53
dkarp Avatar answered Dec 19 '25 07:12

dkarp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!