Thanks to Sendmail/Unix GURU Gernot, here’s an m4 file (stick it in /usr/share/sendmail-cf/cf) that rewrites recipients: OS_special
We had the insane situation at work where emails had to get addressed to “it@acme.com”, but “acme.com” didn’t have an “it”, and the email was actually supposed to go to “smurf@wileycoyote.com”. Don’t ask – it’s ridiculous.
A more realistic implementation would be, for instance, that an email destined to “smurf@acme.com” is not supposed to go to the default mail server, but rather some test-box/honeypot/whatever system. So instead of routing it to “smurf@exchange.acme.com”, we can route it to “smurf@testme.acme.com”
Changes to your existing sendmail.mc file:
At the beginning, do a
include(`/usr/share/sendmail-cf/cf/OS_special.m4')
At the end, after “LOCAL_CONFIG”, but before “LOCAL_RULESETS” (or at the very end if you have neither, do this:
LOCAL_RULE_0
OS_SPECIAL(`smurf@acme.com',smurf,testme.acme.com)
And then rebuild your sendmail.cf