我有使用nodemailer v6.0.0和node v11.4.0的代码
我正在测试消息的迹象。但是我看不到它可行。 我使用以下证书制作了证书:
openssl genrsa -des3 -out private.pem 2048
我有这个代码:
"use strict";
const nodemailer = require("nodemailer");
const fs= require("fs");
async function main(){
let account = await nodemailer.createTestAccount();
let transporter = nodemailer.createTransport({
host: "smtp.ethereal.email",
port: 587,
secure: false, // true for 465, false for other ports
auth: {
user: account.user, // generated ethereal user
pass: account.pass // generated ethereal password
},
tls: {
rejectUnauthorized: false
},
debug:true,
logger: true
});
let mailOptions = {
envelope: {
'from': 'MB_TEST.1.23.455@example.com',
'to': "bar@example.com"
},
from: '<foo@example.com>', // sender address
to: "bar@example.com, baz@example.com", // list of receivers
subject: "Hello ✔", // Subject line
text: "Hello world?", // plain text body
html: "<b>Hello world?</b>", // html body
dkim: {
domainName: "ethereal.email",
keySelector: "2017",
privateKey: fs.readFileSync("private.pem","utf8")
}
};
let info = await transporter.sendMail(mailOptions)
console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
}
main().catch(console.error);
当我看到结果空灵时,它没有对消息签名
有人知道为什么吗?