title: Email not sent via Gmail - Username and Password not accepted
body: <p>I am getting this error while trying to send email via Gmail. Here's the code, in the config.groovy file.</p>
  
  <pre><code>mail.MailMessageBuilder Failed to send email
  org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
  535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 ca4sm3178528pbd.79 - gsmtp
  
          at grails.plugin.mail.MailMessageBuilder$_sendMessage_closure1.doCall(MailMessageBuilder.groovy:112)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)
  Caused by: javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
  535 5.7.8 http://support.google.com/mail/bin/answer.py?answer=14257 ca4sm3178528pbd.79 - gsmtp
  
          at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:843)
          at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:765)
          at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:687)
          at javax.mail.Service.connect(Service.java:345)
          ... 4 more
  </code></pre>
  
  <p>CODE:</p>
  
  <pre><code>grails {
      mail {
        host = "smtp.gmail.com"
        port = 465
        username = "yomama@gmail.com"
        password = "TTYUIoiuy78"
        props = ["mail.smtp.auth":"true",
                 "mail.smtp.socketFactory.port":"465",
                 "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
                 "mail.smtp.socketFactory.fallback":"false"]
      }
   }
  </code></pre>
  
  <p>I tried the suggested solutions from the link provided.</p>
  
  <p>I signed in and changed my password.
  I unlocked captcha DisplayUnlockCaptcha 
  I also clicked on <code>allow less secure apps access the app</code></p>