Y
Y
yvetrov2019-07-20 14:30:46
Node.js
yvetrov, 2019-07-20 14:30:46

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);

However, 20 minutes have already passed since sending, but no messages come to my mail. The message is not in the spam folder, anywhere. But I can read the message itself in the ethereal interface. What to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2019-07-20
@Lynn

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 question

Ask a Question

731 491 924 answers to any question