0
votes

i'm using Grails 2.5.1 and mail:1.0.7 plugin to send emails , but when i'm using it i always getting the bellow error :

Class:javax.mail.AuthenticationFailedExceptionMessage:535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/answer/14257 qq4sm4579366wjc.14 - gsmtp

although i can login with the provided credentials successfully from the browser !!

here are my configurations in the Config file :

grails {
mail {
    host = "smtp.gmail.com"
    port =465
    username = "****"
    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 here is the action :

 mailService.sendMail{
        to userInstance.toEmail
        subject  userInstance.subject
        html "<strong>Test</strong> "
    } 

anything i'm missing ?

2

2 Answers

0
votes

It may be because of gmail's security feature for less secure apps to get authenticated. Just turn on the access for less secure apps.

Follow below steps:

1 Login to your gmail account

2 Access the url: https://www.google.com/settings/security/lesssecureapps

3 Select "Turn on"

-1
votes

If you have gmail - settings for plugin are correct (i have the same and they are working) , but if your email is not gmail you must have other config.

By the way if you gmail :

Username and Password not accepted.

your username or password is wrong, try to login with this Username and password, watch out for register of letters. https://grails.org/plugin/mail