DKIM signing code extracted from mailcomposer

npm install dkim-signer
2 278 downloads in the last day
12 194 downloads in the last week
60 137 downloads in the last month

DKIM Signer

Sign RFC822 messages with DKIM. This module is extracted from mailcomposer.


// require signer function
var DKIMSign = require("dkim-signer").DKIMSign;

// generate a RFC822 message
var rfc822message = "Subject: test\r\n\r\nHello world";

// setup DKIM options
var dkimOptions = {
    domainName: "müriaad-polü",
    keySelector: "dkim",
    privateKey: require("fs").readFileSync("./test_private.pem")

// generate signature header field
var signature = DKIMSign(rfc822message, dkimOptions);

// join signature header field with the message
console.log(signature + "\r\n" + rfc822message);



npm loves you