Hi,
Need some help please.
My postfix server sits on the internet and receives email for several email domains (e.g.
mydomain1.com,
mydomain2.com).
When I send an email to
mye...@mydomain1.com, my postfix server does a lookup (via mysql and virtual alias maps), rewrites the recipient (such as
mye...@mydifferentdomain.com).
What I would like to do is also rewrite the sender domain so that it ends up falling underneath my domain (
mydomain.com). What I've used is sender canonical maps.
sender_canonical_map:
IF !/^.*@(.+\.mydomain1\.com)|(mydomain1\.com)$/
/^(.*)@(.*)$/ ${1}@${2}.
mydomain1.com
ENDIF
IF !/^.*@(.+\.mydomain2\.com)|(mydomain2\.com)$/
/^(.*)@(.*)$/ ${1}@${2}.
mydomain2.com
ENDIF
I've used the postmap -q command to validate that the sender_canonical_map file works successfully.
Now here's my challenge, I would like to rewrite the headers as well, however they need to be a little more clever. For example:
If I send an email from
rando...@randomdomain.com to
mye...@mydomain1.com, the header from field needs to be written like so:
rando...@randomdomain.com.mydomain1.com.
Similarly, if I send an email from
rando...@randomdomain2.com to
mye...@mydomain2.com, the header from field needs to be written like so:
rando...@randomdomain2.com.mydomain2.com.
Now my examples are for specific emails. Is there a way to write rules in such a way the header check will first look at the domain of the To: header and then rewrite the From: header to fall underneath the To: header domain?
Hope that makes sense!
Thanks in advance.
Nolan