This is my settingController:
var sendSmtpMail = function (req,res) {
var transport = nodemailer.createTransport({
service:\'gmail\',
auth: {
You have to allow Less-Secure-Apps to access account settings in your google account - by default, this setting is off and you can simply turn it on. Image example
I encountered the same problem, i solved it as follows:
Click on the Security Icon and you'll be taken to this page where you'll see Less secure apps section, click on it.
Now You'll see this, allow users or give permission here.
And you're not done yet, Not Go to the below link: https://myaccount.google.com/u/1/lesssecureapps
Now you'll see the switch. Enable it and try it'll definitely work.
Peace :)