Why emails are not sending on production server?

2020-07-25 10:35发布

问题:

I'm using the grails plugin "mail=0.9". Emails are not sending on production server. It just works fine on development environment on localhost.

Error is given below;

Stacktrace follows: 
javax.mail.AuthenticationFailedException
        at javax.mail.Service.connect(Service.java:319)
        at org.grails.mail.MailService.sendMail(MailService.groovy:63)
        at org.grails.mail.MailService.sendMail(MailService.groovy:46)
        at org.grails.mail.MailService$sendMail.call(Unknown Source)
        at MailGrailsPlugin$_configureSendMail_closure4.doCall(MailGrailsPlugin.groovy:86)
        at com.tkxel.chefvivant.api.SommelierController$_closure4.doCall(SommelierController.groovy:107)
        at com.tkxel.chefvivant.api.SommelierController$_closure4.doCall(SommelierController.groovy)
        at java.lang.Thread.run(Thread.java:636)

Can anyone help me? Why emails are not sending?

Thanks

回答1:

Finally, after being spending the much time on this issue. I have fixed this error.

Actually the problem was just about to set the Gmail account settings. Google was sending the hidden captcha and that's obvious machine cannot recognize it. So that's why I was getting authentication error.

Solution: I just unlocked the Gmail captcha and now it works fine.

Steps to reproduce this

1. Logout your gmail account first.
2. Visit this url https://accounts.google.com/DisplayUnlockCaptcha and then put username and password to login
3. Press "Continue" button to unlock the captcha
4. It will automatically save the settings.

Now, Check your application to hit the url like "Forgot Password" request. You will must receive email. :)

You can also read this article. http://productforums.google.com/forum/#!topic/gmail/uBdBQAuGeTw

Thanks



回答2:

javax.mail.AuthenticationFailedException
means that you are useing incorrect credentials to access to account you use to send emails.



标签: grails