简体   繁体   English

Nodemailer email 已发送但未收到

[英]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我已经在互联网上搜索了一些人们提出的解决方案,但它们中的任何一个都对我有用:这个另一个,即使使用Nodemailer网站上的示例代码,我也可以使用控制台

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

But email never arrives.但是 email 永远不会到达。

If it helps, using typescript the code i'm using is如果有帮助,使用 typescript 我正在使用的代码是

"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我将 email 发送到临时邮件帐户

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.对于遇到此问题的任何人,如前所述,用于 testAccount 的 Ethereal 服务只是一个假服务,从不提供任何 email。 Consider using other mail service.考虑使用其他邮件服务。

Hope this helps someone.希望这可以帮助某人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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