Sendmail: Setting envelope sender to a fixed value

It may be achieved using ugly but very simple hack. Put it after MAILER(smtp) in your sendmail.mc file and generate new sendmail.cf file.
There MUST BE a tab (\t) before $: in R line.
divert(0) cancels effects of MAILER_DEFINITIONS.

MAILER_DEFINITIONS
SEnvFromSMTP
R$+ <@foo.org.>   $: john.doe <@example.net.>
divert(0)

It adds extra rewriting at the end of rule set handling envelope sender address of all smtp based mailers. The R line rewrites all *@foo.org addresses into [email protected]

You may test it using the script below:

/usr/sbin/sendmail -bt <<END
/tryflags es
/try esmtp [email protected]
END

You may use FEATURE(genericstable) and FEATURE(masquerade_envelope) to rewrite all sender addresses in your host email domain (envelope sender and header sender (From:)).

generictable

@foo.org  [email protected]

Do not forget to specify domains undergoing such rewriting in sendmail.mc:

GENERICS_DOMAIN(`foo.org')

You may use FEATURE(local_no_masquerade) to exclude local email from such rewrites.

http://www.sendmail.com/sm/open_source/docs/m4/masquerading_relaying.html