Answer the question
In order to leave comments, you need to log in
Nodemailer not working. What to do?
I configured my nodemailer like this:
"use strict";
const nodemailer = require("nodemailer");
// async..await is not allowed in global scope, must use a wrapper
async function main(){
// create reusable transporter object using the default SMTP transport
let transporter = nodemailer.createTransport( {
host: "smtp.ethereal.email",
port: 587,
secure: false, // true for 465, false for other ports
auth: {
user: "сгенерированный пользователь", // generated ethereal user
pass: "сгенерированный пароль" // generated ethereal password
}
});
// send mail with defined transport object
let info = await transporter.sendMail({
from: '"Fred Foo " <[email protected]>', // sender address
to: "[email protected], [email protected], [email protected]", // list of receivers
subject: "Hello ✔", // Subject line
text: "Hello world?", // plain text body
html: "<b>Hello world?</b>" // html body
});
transporter.sendMail(info, (err, info) => {
if (err) {
console.log(err)
} else {
console.log(info);
}
});
console.log("Message sent: %s", info.messageId);
// Message sent: <[email protected]>
// Preview only available when sending through an Ethereal account
console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
// Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou
//
}
main().catch(console.error);
Answer the question
In order to leave comments, you need to log in
If you see a message in Ethereal, then nodemailer is working.
In reality, letters are not sent anywhere. That's how it's intended.
https://ethereal.email/
[…] no emails are actually delivered
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question