On live server, it occurs an error that - Error: Invalid login: 534-5.7.14 534-5.7.14 Please log in via 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 195sm513587qkd.6 - gsmtp
I enabled “Less secure apps” in my google account.
Hey @hyla526, before moving forward, I want to confirm that this code is in a Netlify function? If it’s not, then it’s not getting deployed since, with Netlify and the Jamstack in general, there’s no server at runtime. If it is, please go ahead and send your Netlify URL and an x-nf-request-id so we can dig in further!
In the meantime, I wanted to share another post on this topic that may be helpful:
A small tip for gmail. You can make an app specific password for nodeMailer.
If you have enabled 2-factor authentication on your Google account you can’t use your regular password to access Gmail programmatically. You need to generate an app-specific password and use that in place of your actual password.
Log in to your Google account
Go to My Account > Sign-in & Security > App Passwords
(Sign in again to confirm it’s you)
Scroll down to Select App (in the Password & sign-in method box) and choose Other (custom name)
Give this app password a name, e.g. “nodemailer”
Copy the long generated password and paste it into your Node.js script instead of your actual Gmail password. (You don’t need the spaces.)