问题描述
我正在编写一个需要能够发送电子邮件的 Nodejs 应用程序.到目前为止,我已经将 Postfix 与名为 Nodemailer 的 Nodejs 模块结合使用,通过 Amazon SES 发送我的电子邮件.
I'm writing a Nodejs app that needs to be able to send email. So far, I've used Postfix in conjunction with a Nodejs module called Nodemailer to send my email through Amazon SES.
Postfix 一直在处理 DKIM 签名,但现在我想摆脱 postfix,只使用 Nodemailer 通过 Amazon SES 发送电子邮件.
Postfix has been handling the DKIM signing, but now I wish to get rid of postfix and just use Nodemailer to send emails through Amazon SES.
我现在唯一的问题是找到一种在 Nodejs 中签署电子邮件的方法.我想过在节点中使用exec"运行 opendkim 命令,但一直无法弄清楚.从搜索来看,似乎也没有用于此的模块.
My only problem now is finding a way to sign emails within Nodejs. I've thought of running a opendkim command using "exec" in node but haven't been able to figure that out. From searching, there looks to be no modules for this either.
有人可以帮我吗?
推荐答案
Nodemailer 最新版本支持 DKIM 开箱即用, 也用 SES 测试过.
Latest version of Nodemailer supports DKIM signing out of the box, also tested with SES.
var transport = nodemailer.createTransport("SES", {
AWSAccessKeyID: "AWSACCESSKEY",
AWSSecretKey: "AWS/Secret/key"
});
// all messages sent with *transport* are signed with the following options
transport.useDKIM({
domainName: "example.com",
keySelector: "dkimselector",
privateKey: fs.readFileSync("private_key.pem")
});
transport.sendMail(...);
这篇关于在 Node.js 中使用 DKIM 签署电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!