How should I use nodemailer with gmail as the google has disabled less secure apps access on every account, I had created two new accounts but could not enable less secure access.
Here is what the google is showing in my new account:
Here is my code:
const nodemailer = require('nodemailer')
let transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: "myemail@gmail.com",
pass: "MyPassword",
},
});
let mailOptions = {
from: 'dsigmatesting@gmail.com',
to: "akabir247@gmail.com",
subject: `The subject goes here`,
html: `The body of the email goes here in HTML`,
};
transporter.sendMail(mailOptions, function (err, info) {
if (err) {
console.log(err)
} else {
console.log(info)
}
});
Please help me in the process of solving this problem.
From the Nodemailer Github repo:
...,
auth: {
user: 'yourmail@gmail.com',
pass: 'your_new_app_password',
},
...