Monday, November 21, 2011

Sendmail: how to masquarate from oracle@host.domain.com to oracle@domain.com

root@wbitdb1:/etc/mail # diff sendmail.cf sendmail.cf.21012008
986,987c986
< #R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
< R$* < @ *LOCAL* > $*  $: $1 < @ $M . > $2
---
> R$* < @ *LOCAL* > $*  $: $1 < @ $j . > $2
root@wbitdb1:/etc/mail #


add the line shown below
--------------
###################################################################
###  Ruleset 94 -- convert envelope names to masqueraded form   ###
###################################################################

SMasqEnv=94
#R$* < @ *LOCAL* > $*   $: $1 < @ $j . > $2 <--------------- this line commented
R$* < @ *LOCAL* > $*    $: $1 < @ $M . > $2 <--------------- this line added


----------
Testing masquerading
sendmail's address test mode makes it easy to test masquerading.
====================================================

# sendmail -bt
/tryflags HS (to test the header sender address; other tryflags values would be ES, HR, and ER, for envelope sender, header recipient, and envelope recipient, respectively)
/try esmtp email_address_to_test

Example:
sendmail -bt
> /tryflags ES
> /try esmtp user@host.domain.com
Trying envelope sender address user@host.domain.com for mailer esmtp

(many lines omitted)

final            returns: user @ domain . com
Rcode = 0, addr = user@domain.com