I have used my 2,gmail account one to send a plan text message to the other one as client. Using nodemailer,nodemailer cannot send the message after making so many attempt. I turn on login from 2step,in gmail setting still cannot send the message please help.
my code snippet
async function handleEMail(req, res, next) {
var { user } = req;
const transporter = nodemailer.createTransport({
host: "smtp.gmail.com",
port: 465,
secure: true,
auth: {
user: "iluvemimum2@gmail.com",
Password: "ruthtersoor090"
}
});
const mailOption = {
from: "iluvemimum2@gmail.com",
to: user.email,
subject: "sending nodemailer",
text: "can you see the server mail"
};
const plan = transporter.sendMail(mailOption, function(error) {
if(error){
res.status(404);
res.send("error email to client ");
}else{next()}
});
If you donât mind can I have your code snippet ,for only nodemailer. Or may be we have the same code type,
Am considering the Hotmail since all my effort at gmail hit the rock.
And are you suggesting using the email directly from nodemailer could be one of the problem.
I just think for your auth object in the transporter and from key in the mailOption you might feel better storing that sensitive information in an env file.
You will see in my app.js that I am referring to that information in variables.
sorry do you have idea about this error Error: Missing credentials for "LOGIN"
in case you will like to refer to the project use this link: Glitch. the error above is what am getting from the console
yeah, i equally google the error but i could understand little that , the node mailer does not pass a number directly, you need to pass it through a string. that is why you see the toString().
I have made the correction you suggested and i think it work. cause this is the message i got from the console :: Error: Invalid login: 535 5.7.3 Authentication unsuccessful [BLAPR03CA0108.namprd03.prod.outlook.com]
at SMTPConnection._formatError (/rbd/pnpm-volume/34e924cd-c1b6-43f5-9142-4acf8cf7d4de/node_modules/.registry.npmjs.org/nodemailer/6.6.3/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/rbd/pnpm-volume/34e924cd-c1b6-43f5-9142-4acf8cf7d4de/node_modules/.registry.npmjs.org/nodemailer/6.6.3/node_modules/nodemailer/lib/smtp-connection/index.js:1536:34)
at SMTPConnection.<anonymous> (/rbd/pnpm-volume/34e924cd-c1b6-43f5-9142-4acf8cf7d4de/node_modules/.registry.npmjs.org/nodemailer/6.6.3/node_modules/nodemailer/lib/smtp-connection/index.js:1490:18)
at SMTPConnection._processResponse (/rbd/pnpm-volume/34e924cd-c1b6-43f5-9142-4acf8cf7d4de/node_modules/.registry.npmjs.org/nodemailer/6.6.3/node_modules/nodemailer/lib/smtp-connection/index.js:947:20)
at SMTPConnection._onData (/rbd/pnpm-volume/34e924cd-c1b6-43f5-9142-4acf8cf7d4de/node_modules/.registry.npmjs.org/nodemailer/6.6.3/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData (/rbd/pnpm-volume/34e924cd-c1b6-43f5-9142-4acf8cf7d4de/node_modules/.registry.npmjs.org/nodemailer/6.6.3/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)
at TLSSocket.emit (events.js:196:13)
at addChunk (_stream_readable.js:290:12)
at readableAddChunk (_stream_readable.js:271:11)
at TLSSocket.Readable.push (_stream_readable.js:226:10) {
}
though am still using gmail. so am going to try using hotmail now , the question were your using both hotmail, or you were sending hotmail against gmail.???
but come to think of it you pass yours without the toString.
congrats, the message was delivered, but as junk message that is outlook. i have a question like:
How can we deliver the message in the inbox
I dont know but i feel people go for gmail more than any other mail, now how can we send message to gmail .
Some one suggested you can deactivate secure login from gmail setting , but that is putting the mail at risk if you ask me . can you suggest anothe method??
I didnât have any issue having message going to the inbox. So I am not sure why yours is going to the junk mail.
Maybe you can try asking on stackoverflow and see if someone has the solution.
You can also dig around the past github issues for nodemailer and see if the answer is in there.