Ian! D. Allen:
> This is a query about how to have Postfix rewrite a From: address only
> for messages sent to a particular destination address.
> 
> I've set my Postfix transport map so that most of my home email (From:
> idal...@idallen.ca) goes out via my web host idallen.ca:
> 
>     smtp:[idallen.ca]:submission
> 
> My College often throws idallen email into spam folders, so I have set
> up a preceding transport map line that sends anything destined to my
> College directly into the College with authentication:
> 
>     mycollege.com smtp:[outlook.office365.com]:submission
> 
> In my mutt email client I created a send-hook that rewrites my From:
> address to be the required address for my College (required for office365)
> only for messages destined for my College.  If not going to my College,
> mutt leaves the From: address set to idal...@idallen.ca.
> 
> That's great for messages I send with mutt, but it doesn't fix the
> From: address for messages to my College sent using any other method
> (e.g. directly with sendmail or using Perl, etc.); those other methods
> still have From: idal...@idallen.ca and they get rejected by office365.
> 
> How can I have Postfix rewrite my From: address *only* for messages
> destined for my College, or for messages using the mycollege.com transport
> line (same thing)?  (Then I wouldn't need the mutt send-hook.)

This needs a dedicated SMTP transport for the college, smtp_generic_maps
setting that replaces idal...@idallen.ca with your college email address.

master.cf:
smtp      unix  -       -       n       -       -       smtp
    -o smtp_generic_maps=maptype:mapname

Or with Postfix 3 and later:

master.cf:
smtp      unix  -       -       n       -       -       smtp
    -o { smtp_generic_maps = inline:{{idal...@idallen.ca = you@college}}}

Which keeps it all together in one place.

This updates envelope addresses and header addresses.

        Wietse

Reply via email to