-
-
Save emaV/6283826 to your computer and use it in GitHub Desktop.
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
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