6

I need a way to configure sendmail to set the envelope sender of every message to a fixed value (say [email protected]). Note that this is not answered by any of the MASQUERADE features/macros (that I know of): I want to also override the envelope user and set it to a fixed value.

EDIT: Also, I do not want to masquerade the header sender. So GENERICSTABLE + MASQUERADE_ENVELOPE does not cut it, either. What I need is the equivalent of command line sendmail -f [email protected]

(Rationale: I am forced - by the customer - to go through an authenticating relay which insists on having a given envelope sender address - and no, I am not trying to circumvent any antispam measure, I merely want to send root's mail - and other administrative stuff - offsite. It is an application server, and all the mail is originated by servers, but sender addresses need to be meaningful nevertheless)

TIA.

0

2 Answers 2

3
+50

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
2
  • Xactly what I was looking for. Thx. Mar 10, 2014 at 13:38
  • It is a simple, easy to maintain but uncomfortably hackish mc fix. The right way from cf perspective would be longer and harder to maintain on long run. Welcome to the world without perfect choices :-)
    – AnFi
    Mar 10, 2014 at 14:57
2

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

1
  • This is interesting, but I want the header sender to remain untouched. Editing the question to reflect this. I suspect that a LOCAL_RULE (something) is called for to nail this, but that's above my capacity to write. Feb 28, 2014 at 8:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .