Created
February 14, 2017 08:00
-
-
Save andris9/ef6e0f9014b6502077cf2d938412f400 to your computer and use it in GitHub Desktop.
ZoneMTA DKIM plugin example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugins": { | |
"dkim": { | |
"enabled": "sender", | |
"domain": "example.com", | |
"selector": "test", | |
"path": "/path/to/private/key.pem" | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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(); | |
}; |
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
Thank you very much!