Nodemailer email sended but not received

Viewed 28

I've loked arround the internet for some solutions people propose, but any of them works for me fe: this one or this other one, even using the example code from Nodemailer website, i get on console

Message sent: <c2666ca9-9850-ffce-bcce-8fad0b8f41b8@example.com>
Preview URL: https://ethereal.email/message/Yxi21TBgBufqRAO3Yxi21mTcOrtHln6cAAAAAXYGM7S1KpoqqzcPthnCZbg

But email never arrives.

If it helps, using typescript the code i'm using is

"use strict";
const nodemailer = require("nodemailer");

async function main() {
  let testAccount = await nodemailer.createTestAccount();

  let transporter = nodemailer.createTransport({
    host: "smtp.ethereal.email",
    port: 587,
    secure: false,
    auth: {
      user: testAccount.user,
      pass: testAccount.pass,
    },
  });

  let info = await transporter.sendMail({
    from: '"Fred Foo " <foo@example.com>',
    to: "bepaxeb636@esmoud.com",
    subject: "Hello ✔",
    text: "Hello world?",
    html: "<b>Hello world?</b>",
  });

  console.log("Message sent: %s", info.messageId);

  console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
}

main().catch(console.error);

I'm sending the email to a temporary mail account

Hope someone can help me, and any other one with this issue. Thanks in advantadge!

1 Answers

For anyone being arround with this trouble, as said, the Ethereal service used for the testAccount is just a fake service, never delivers any email. Consider using other mail service if you expect the mails to arrive.

Hope this helps someone.

Related