简体   繁体   中英

Nodemailer email sended but not received

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!

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.

Hope this helps someone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM