NodeMailer空灵电子邮件未发送到Gmail
我试图使用以下函数使用Express JS服务器发送电子邮件。似乎工作正常。但是,当我发送电子邮件时,它在我的Gmail收件箱或垃圾邮件中不可见。
我使用的功能:
const transporter = nodemailer.createTransport({
host: 'smtp.ethereal.email',
port: 587,
auth: {
user: '[email protected]',
pass: 'BJkKV41tNZNBmMkkCw'
}
});
function SendEmail(email,subject,text,html) {
return new Promise(async (resolve, reject) => {
try {
let info = await transporter.sendMail({
from: "[email protected]",
to: email,
subject: subject,
text: text,
html:html
})
resolve(info)
} catch (error) {
reject(error)
}
})
}
接收到的响应:
{
"accepted": [
"[email protected]"
],
"rejected": [],
"envelopeTime": 759,
"messageTime": 506,
"messageSize": 596,
"response": "250 Accepted [STATUS=new MSGID=YpXX5N-8J14cOJVHYpXjvw93heVfMHMGAAAAA4okSTkzId5ci.tBPvM2244]",
"envelope": {
"from": "[email protected]",
"to": [
"[email protected]"
]
},
"messageId": "<[email protected]>"
}
但未交付给Gmail。如何解决并向我解释原因?
I'm trying to send emails using the following function using express js server. It seems to be working fine. But when I send email it’s not visible in my gmail inbox or spams.
Function i used:
const transporter = nodemailer.createTransport({
host: 'smtp.ethereal.email',
port: 587,
auth: {
user: '[email protected]',
pass: 'BJkKV41tNZNBmMkkCw'
}
});
function SendEmail(email,subject,text,html) {
return new Promise(async (resolve, reject) => {
try {
let info = await transporter.sendMail({
from: "[email protected]",
to: email,
subject: subject,
text: text,
html:html
})
resolve(info)
} catch (error) {
reject(error)
}
})
}
Response received:
{
"accepted": [
"[email protected]"
],
"rejected": [],
"envelopeTime": 759,
"messageTime": 506,
"messageSize": 596,
"response": "250 Accepted [STATUS=new MSGID=YpXX5N-8J14cOJVHYpXjvw93heVfMHMGAAAAA4okSTkzId5ci.tBPvM2244]",
"envelope": {
"from": "[email protected]",
"to": [
"[email protected]"
]
},
"messageId": "<[email protected]>"
}
But not delivered to gmail. How to fix and explain to me the reason ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
空灵是假SMTP服务,主要针对NodeMailer和EmailEngine用户(但不限于)。这是一项完全免费的反交易电子邮件服务,消息永远不会传递。
相反,您可以直接从NodeMailer生成虚荣电子邮件帐户,就像与其他任何SMTP提供商一样,使用该帐户发送电子邮件,最后在此处预览发送消息,因为实际上没有发送电子邮件。
只是如Ethereal的主页中所述,它实际上并未传递邮件。
您可以检查此链接。
链接: https://ethereal.email/
Ethereal is a fake SMTP service, mostly aimed at Nodemailer and EmailEngine users (but not limited to). It's a completely free anti-transactional email service where messages never get delivered.
Instead, you can generate a vanity email account right from Nodemailer, send an email using that account just as you would with any other SMTP provider and finally preview the sent message here as no emails are actually delivered.
just as stated in home page of ethereal, it does not actually deliver mail.
you can check on this link.
link: https://ethereal.email/
这就是方式:
This is the way:
我也有空灵的问题,但是使用Gmail帐户工作正常!
请记住使用2FA身份验证,这是文档:
https://nodemailer.com/usage/usage/using-using-using-usish-using-using-using-using-usish-usis- gmail/
I have some issues with Ethereal too , but using a Gmail account work ok!.
Remember use a 2FA authentication, here is the doc:
https://nodemailer.com/usage/using-gmail/
不确定您可以使用它传递邮件。这是测试网的东西。
Not sure you can use it to deliver mails. It's kinda testnet stuff.