Skip to content

Instantly share code, notes, and snippets.

@baudehlo
Created August 20, 2013 14:05
Show Gist options
  • Save baudehlo/6281912 to your computer and use it in GitHub Desktop.
Save baudehlo/6281912 to your computer and use it in GitHub Desktop.
exports.hook_rcpt = function (next, connection, params) {
var recip = params[0];
if (connection.relaying) {
// Already relaying - skip.
return next();
}
if (recip.host != 'emailitin.com') {
return next(DENY, "Invalid domain");
}
if (connection.transaction.rcpt_to.length > 1) {
return next(DENYSOFT, "Can only deal with one recipient at a time");
}
if (recip.user === 'support' || recip.user === 'help' || recip.user === 'matt') {
connection.relaying = true;
recip.user = 'helpme+emailitin-' + recip.user;
recip.host = 'gmail.com';
recip.original = recip.user + '@' + recip.host;
this.loginfo("Special user - relaying this email to: " + recip.original);
return next(OK);
}
next();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment