问题描述
我正在编写一个需要能够发送电子邮件的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.
任何人都可以帮我吗?
推荐答案
的最新版本支持开箱即用的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签署电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!