Signing emails with DKIM in Node.js

时光总嘲笑我的痴心妄想 提交于 2019-11-30 13:57:45

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(...);

you can find at https://gist.github.com/2198497 an implementation I developped to dkim-sign mails sent through SES. It's heavily inspired by the php implementation by Ahmad Amarullah found here : http://code.google.com/p/php-mail-domain-signer/. I'm well aware the code is far from clean, but it should help you get started. The mails sent through it are considered correct by gmail and yahoo. Don't hesitate if you have questions / can't get it to work.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!