EmailException: Sending the email to the following server failed : smtp.gmail.com:465

10,156

This kind of exception commonly occurs because the service provider protects your account by modern security standards.

You have to disable this for executing your application in the right way. You can do this by visiting the link https://www.google.com/settings/security/lesssecureapps
after log in into your Gmail account, and turn on the access for the less secure app.

I hope this will bring you out of the issue. :-)

Share:
10,156
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    I wrote a program to send mail from my gmail account using scala Play 2.3.8 then i got the following exception:

    [EmailException: Sending the email to the following server failed : smtp.gmail.com:465] at MailerPlugin.send(email)

    my code is as follows:

      val email = Email(
      "A personal mail",
      "LeeSa <[email protected]>",
      Seq("Recepient <[email protected]>"),
      // adds attachment
      attachments = Seq(
    
      ),
      bodyHtml = Some("""
      <html>
        <body>
        <h3>Hai ,</h3>
        <p> This is a test message. </p>
        </body>
      </html>
      """)
    )
    MailerPlugin.send(email)
    

    application.conf contains the configuration

        smtp.host=smtp.gmail.com
        smtp.port=465
        smtp.ssl=yes
        smtp.tls=yes
        smtp.user="[email protected]"
        smtp.password="MyPassword"
    

    Anyone can help me?