In article <78X1i.6968$U01.100830@twister1.libero.it> HH
<already@enough.spam.thank.you> writes:
>I'd like to rewrite the envelope MAIL FROM address (if it is a certain
>address) and substitute it with the header FROM: address if that one is
>one of a certain set, e.g.
>- if envelope MAIL FROM: <aaaa@b.c>
>- and header FROM: <xxxx@y.z>
>then set the envelope MAIL FROM: <xxxx@y.z>
I really think you should try do this outside of sendmail - e.g. at the
source of the message - or fix whatever brokenness at the receiver end
that makes you want to do such a thing. It's not a "normal" thing to
do...
If you insist on having sendmail doing it, the best bet would probably
be via a milter (i.e. still "outside of sendmail":-).
AFAIK even a
milter can't modify the envelope sender directly, but it can resend the
message with a new envelope sender.
Doing it in sendmail.cf would be "hard". The envelope/header
sender/recipient addresses are passed through the rulesets separately,
and while you can check which one you're currently processing via
$&{addr_type}, you can't just modify one while you're processing
another. The envelope sender is available in $&f, but I'm not at all
sure that modifying it (via the 'macro' map) would actually affect the
resulting envelope sender on the message that leaves sendmail.
What would likely work would be to store the header sender in a macro
e.g. in ruleset 1, and then modify the MasqEnv ruleset to replace the
envelope sender based on the contents of that macro. Of course MasqEnv
can't be modified from the .mc file though, for an .mc-based solution
this method would require custom mailer definitions in there that called
a custom ruleset that did this check and/or called MasqEnv.
>Is there something like this already possible,
No.
> or where to find any pointers how to start ?
Above and doc/op/op.*
--Per Hedeland
per@hedeland.org