如何在启用DKIM的情况下通过nodemailer
发送直接电子邮件?
我试过
const nodemailer = require('nodemailer')
const directTransport = require('nodemailer-direct-transport')
const transporter = nodemailer.createTransport(
directTransport({
dkim: {
domainName: "mydomain.com",
keySelector: "mail",
privateKey: "<generated private key>"
}
}))
require('express')().get('/test', (req, res, next) => {
console.log('sending mail')
mailer.sendMail({
from: 'support@mydomain.com',
to: 'pmmEoRzqH5EyTO@dkimvalidator.com',
subject: 'test email',
html: 'Email content'
}, (err, reply) => {
console.log('email sent')
console.log(err && err.stack)
console.dir(reply)
})
res.send('test').end()
})
I also added the public key as TXT record to my DNS panel.
我在http://dkimvalidator.com/results
检查时发送了电子邮件但没有DKIMDKIM信息:DKIM签名
此消息不包含DKIM签名
有人有这个成功吗?这看起来是一种直接便宜的方式来发送电子邮件而无需设置SMTP服务器,但我没有看到任何帖子。
答案 0 :(得分:0)