On 19 Nov 2017, at 11:36 (-0500), Jack Bates wrote:
Is there a feature I can use to rewrite the To: header, of "virtual
alias domain" mail, with the result of the following lookup, *after*
smtpd_milters are applied?
SELECT 'b...@example.com' FROM my_table WHERE sender = '%s'
Do you actually have a field named 'b...@example.com' in my_table? That
is an unusual choice....
Or do I need to use a milter of my own for this?
Simpler to do with a content filter, unless you already have a highly
flexible milter (e.g. MIMEDefang) already in place that can be made to
mangle messages. See the FILTER_README file for details.
recipient_canonical_maps and recipient_canonical_classes seem pretty
close! I can exclude the From: header and the envelope_recipient from
being rewritten, but they're applied *before* smtpd_milters. And I
haven't thought carefully about how to limit them to virtual alias
domain mail.
My specific situation is that I'm using the OpenDKIM milter to verify
mail, so that needs to happen before I rewrite the To: header.
OK, but this leaves an obvious unanswered question: WHY?
Modifying the To header invalidates any DKIM signature so that if the
end recipient tries to verify it, the message will appear to be a fake
or tampered-with (which it is.) If something downstream is dependent on
the To header (instead of the envelope recipient or a header derived
from it) that should be corrected, rather than invalidating the
signature on the message.
--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Currently Seeking Steady Work: https://linkedin.com/in/billcole