Nodemailer works on local, but not works without displayunlockcaptcha on Netlify

I have an email verification feature through nodemailer in node server. It works on localhost, but not works on Netlify once it’s deployed. Here are my codes.

const transporter = nodemailer.createTransport({
       host: "",
       port: 465,
       secure: true,
       auth: {
           user: "",
           pass: "mypassword",

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 195sm513587qkd.6 - gsmtp

I enabled “Less secure apps” in my google account.

And allowed as well

it worked a while, but since I cleared browser histories, it didn’t work again.

So I allowed displayunlockcaptch again, it worked.

It means I should allow displayunlockcaptcha every times.

Is there any way to keep allowing it? Or any other way?

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: