Skip to content

Instantly share code, notes, and snippets.

@andris9
Created February 14, 2017 08:00
Show Gist options
  • Save andris9/ef6e0f9014b6502077cf2d938412f400 to your computer and use it in GitHub Desktop.
Save andris9/ef6e0f9014b6502077cf2d938412f400 to your computer and use it in GitHub Desktop.
ZoneMTA DKIM plugin example
{
"plugins": {
"dkim": {
"enabled": "sender",
"domain": "example.com",
"selector": "test",
"path": "/path/to/private/key.pem"
}
}
}
'use strict';
// save as plugins/dkim.js
const fs = require('fs');
module.exports.title = 'DKIM signer';
module.exports.init = function (app, done) {
let privKey;
try {
privKey = fs.readFileSync(app.config.path, 'ascii').trim();
} catch (E) {
app.logger.error('DKIM', 'Failed loading key: %s', E.message);
return done;
}
app.addHook('sender:connect', (delivery, options, next) => {
if (!delivery.dkim.keys) {
delivery.dkim.keys = [];
}
delivery.dkim.keys.push({
domainName: app.config.domain,
keySelector: app.config.selector,
privateKey: privKey
});
next();
});
done();
};
@Manishjodhani
Copy link

Manishjodhani commented Mar 21, 2018

Where should we create this config.json file...????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment