Closed tircnf closed 2 years ago
Mail 1.0.7 works for my Gmail account (grails 2.4.2). Make sure you are using the right Config.groovy settings for its SSL, here's mine for example:
grails { views { mail { host = "smtp.gmail.com" port = 465 username = "temp@gmail.com" password = "PASSWORD" props = ["mail.smtp.auth":"true", "mail.smtp.socketFactory.port":"465", "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory", "mail.smtp.socketFactory.fallback":"false"] } }
I also had 2 factor authentication so I even had to generate an app specific password from GMail for it.
Thanks for the response. I am using those exact same settings.
There is a setting under gmail to "allow less secure apps" down near the bottom of the page https://myaccount.google.com/security?utm_source=OGB
After upgrading to 1.0.7 you have to set this value to "true" in order for the mail plugin to send a message.
With 1.0.1 version of the plugin, this setting is not required and google is happy.
@harbdog -- is your gmail configured to "allow less secure apps?"
@tircnf I'm not even seeing that option in my google account settings
@harbdog -- sorry for my slow response. Work has had me sequestered for a few days.
Click on the little number bad at the top of the gmail web page. Then click on "My Account"
On the My Account page, click on "Sign-in & Security"
(or you can just click this link while signed into gmail.. and it should take you straight to your security page. https://myaccount.google.com/security?utm_source=OGB
after scrolling down 2-3 pages, on the very bottom you can see the "Allow less secure apps:
Anyway, after all that, I guess this probably isn't specifically a grails plugin issue. Grails mail 1.0.1 uses javax.mail version 1.4.3 Grails mail 1.0.7 uses javax.mail version 1.5.1
I haven't figured out what changed, but the upgrade to 1.5.1 must have irritated something in the gmail authentication.
Here is a related stack-overflow post.
http://stackoverflow.com/questions/18778240/solve-error-javax-mail-authenticationfailedexception
And their solution is to click the "allow less secure apps" button. :(
@tircnf Ok I finally figured out why I don't see it. In that stackoverflow you posted they have a link directly to the section you mentioned.
https://www.google.com/settings/security/lesssecureapps
It appears it's not allowed with 2-step authentication. Anyone not using 2-step really should consider it.
Less secure apps Some apps and devices use less secure sign-in technology, which makes your account more vulnerable. You can turn off access for these apps, which we recommend, or turn on access if you want to use them despite the risks. Learn more
This setting is not available for accounts with 2-Step Verification enabled. Such accounts require an application-specific password for less secure apps access. Learn more
I just tried upgrading from 1.0.1 version of the plugin to 1.0.7.
When I do, I can no longer send emails using a gmail configuration. The gmail smtp server responds with an error saying to try and log into gmail using the web interface.
At the same time an email is sent from google to the username i was using to authenticate saying that
subject: Sign-in attempt prevented
Someone just tried to sign in to your Google Account xxxx@gmail.com from an app that doesn't meet modern security standards. Details: Tuesday, November 17, 2015 11:05 PM (Central Standard Time) XXXXXXX, XX, USA* We strongly recommend that you use a secure app, like Gmail, to access your account. All apps made by Google meet these security standards. Using a less secure app, on the other hand, could leave your account vulnerable. Learn more.
It includes a link to the following page: https://support.google.com/accounts/answer/6010255
that suggests that if you really want this to work you have to enable the "Less secure apps" section in My Account. (https://www.google.com/settings/security/lesssecureapps)
I created this from a grails 2.4.5 app with a compile time dependency to the mail 1.0.7 plugin, and the sample "gmail" mail configuration from the documentation.