On 19 November 2017 at 16:36, Jack Bates <vgn...@nottheoilrig.com> 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' > > Or do I need to use a milter of my own for this? > > 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.
Just checking that you really want/need to rewrite the To: header and not just the actual recipient? virtual_alias_(domains|maps) can do the latter. Otherwise, maybe smtp_generic_maps.