Node.js NodeEmailer在浏览器中显示电子邮件,而不是发送电子邮件
我正在尝试使用电子邮件模板包,但遇到了一个问题。在我将路径从静态文件更改为url之前,一切都很正常。从那时起,每当我试图发送电子邮件时,它只会在浏览器中显示临时文件,而不是实际发送任何电子邮件。我试着把它改回去,但问题仍然存在。因为这是关于附件的,所以我假设这是一个节点电子邮件问题,而不是电子邮件模板问题。 这是我的密码:Node.js NodeEmailer在浏览器中显示电子邮件,而不是发送电子邮件,node.js,email,nodemailer,Node.js,Email,Nodemailer,我正在尝试使用电子邮件模板包,但遇到了一个问题。在我将路径从静态文件更改为url之前,一切都很正常。从那时起,每当我试图发送电子邮件时,它只会在浏览器中显示临时文件,而不是实际发送任何电子邮件。我试着把它改回去,但问题仍然存在。因为这是关于附件的,所以我假设这是一个节点电子邮件问题,而不是电子邮件模板问题。 这是我的密码: const Email = require("email-templates"); email = new Email({ message: { fr
const Email = require("email-templates");
email = new Email({
message: {
from: "pribehytest@seznam.cz"
},
// uncomment below to send emails in development/test env:
// send: true
transport: {
host: "smtp.seznam.cz",
port: 465,
secure: true,
auth: {
user: "mail",
pass: "password"
}
}
})
// this is in a different file
pdf.create(compiledPugInvoice({
// some locals
}), {format: "Letter"}).toFile("emails/newOrder/invoices/invoice" + orderID + ".pdf", (err, result) => {
if(err) next(err);
else{
cloudinary.uploader.upload("emails/newOrder/invoices/invoice" + orderID + ".pdf", (cloudinaryResult) => {
console.log(cloudinaryResult);
// send an email to the client
email
.send({
template: "newOrder",
message: {
to: req.body.email,
attachments: [
{
filename: "faktura.pdf",
path: cloudinaryResult.secure_url
}
]
},
locals: {
// some locals
}
})
.then(() => {
fs.unlink("emails/newOrder/invoices/invoice" + orderID + ".pdf", (err) => {
if(err) next(err);
}))
.catch(console.error);
});
如果使用
NODE\u ENV=production
运行应用程序,是否也会发生这种情况?