Markus Hayner
Markus Hayner

Reputation: 2959

Sending email using Gmail with Nodemailer from AWS

I got a strange error while I am trying to send an email using the code on AWS. If I use the code from local everything works fine but when I am on the server I receive the following error. Any idea?

Error: Invalid login: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbvn
534-5.7.14 z2Ma4babAdhc731mC7le5AHx_-Q-tufA-9pLUMKRCPKz1v16SHIFMuBJVTxzR8EkKfiA1E
534-5.7.14 s1fNuhnKyPpEiNtvkWgMDApbGb4lp0gJ1vRAJeISvp8lvn7CWU1F1hO94qHMImN5mo6DB1
534-5.7.14 0EKQuQeY092rxtuFMPrswlS0t8TUmTDfvaHus1Hp5DqrBt4J3QH3JTBQaiXmaz3HI-q-dQ
534-5.7.14 oSx2y2TXMFgcmw4nkU-Bjagkep5zlDzrDXP5uvglxvZqoU6rif> Please log in via
534-5.7.14 your web browser and then try again.
534-5.7.14  Learn more at
534 5.7.14  https://support.google.com/mail/answer/78754 b139-v6sm7016042wmd.36 - gsmtp

The credentials are fine and 'Allow less secure apps' is ON

Thanks

Upvotes: 1

Views: 1487

Answers (2)

pinzon
pinzon

Reputation: 1

this code work in AWS and Express js

var transporter = nodemailer.createTransport({
    host: "smtp.gmail.com",
    secureConnection: false,
    port: 587,
    tls: {
        ciphers: 'SSLv3'
    },
    requireTLS: true,
    auth: {
        user: 'mygmail',
        pass: 'mypass'
    }
});

Upvotes: 0

antzshrek
antzshrek

Reputation: 9933

First thing I might wanna say it, change your password and try it again, but if you still get the same thing, I will suggest you try these options:

Google has listed all the potential problems and fixes for us. In as much as you turned on less secure apps setting. Be sure you are applying these to the correct account.

Step 1: Check your password

If you have these problems or can’t sign in, first check to make sure you’re using the right password.

Step 2: Try these troubleshooting steps

  • If you've turned on 2-Step Verification for your account, you might need to enter an App password instead of your regular password.
  • Sign in to your account from the web version of Gmail at https://mail.google.com. Once you’re signed in, try signing in to the mail app again.
  • Visit Display Unlock Captcha and sign in with your Gmail username and password. If asked, enter the letters in the distorted picture.
  • Your app might not support the latest security standards. Try changing a few settings to allow less secure apps access to your account.
  • Make sure your mail app isn't set to check for new email too often. If your mail app checks for new messages more than once every 10 minutes, the app’s access to your account could be blocked.

For further reading, you might want to check

  1. How can I avoid google mail server asking me to log in via browser?
  2. Gmail SMTP debug: error “please log in via your web browser”

Upvotes: 1

Related Questions