Skip to content

Instantly share code, notes, and snippets.

View smfreegard's full-sized avatar

Steve Freegard smfreegard

  • Fort Systems Ltd.
  • Chichester, UK
View GitHub Profile
const Address = require('address-rfc2821').Address;
exports.hook_rcpt = function (next, conn, rcpt) {
const txn = conn.transaction;
const cfg = this.config.get('forwarder.ini');
conn.loginfo(this, JSON.stringify(cfg));
if (rcpt && rcpt[0] && rcpt[0].host) {
var domain = rcpt[0].host.toLowerCase();
if (cfg.main[domain]) {
conn.loginfo(this, 'Found domain ' + domain + ' forwarding to ' + cfg.main[domain]);
exports.hook_rcpt = function (next, connection) {
var txn = connection.transaction;
if (txn.rcpt_to.length > 1) {
return next(DENY, 'Multiple recipients not allowed');
}
return next();
}