John G
2019-02-03 21:47:50 UTC
I searched the list and read the documentation, but have not seen a solution to what I need to do.
I need to use something like ACCESS to intercept email from a particular email address or domain and, rather that reject or accept the email, I need to rewrite the destination address to a specific local address no matter what local address it is actually addressed.
I saw this for using header_checks https://serverfault.com/questions/284702/redirect-specific-e-mail-address-sent-to-a-user-to-another-user:
You can use PCRE In /etc/postfix/main.cf:
header_checks = pcre:/etc/postfix/headers_check
/etc/postfix/headers_check:
/To:.*@(?!mail.domain.com) && From:.*@?!extdomain.com/ REDIRECT ***@mail.other.domain.com
PCRE works with perl regular extentions, and you can specify any conditions.
But someone commented:
The voted answer will not work because postfix checks one header at a time, as the manual clearly states. postfix.org/header_checks.5.html
I checked the manual page and it does state that checks are made one header at a time, so I don't think checking for To and From in the test would work. I have not tried it.
I know address rewriting is at the heart of Postfix, but I just have not found a solution in the documentation, this list, or the How Tos.
Sure would appreciate a helping hand with this.
I need to use something like ACCESS to intercept email from a particular email address or domain and, rather that reject or accept the email, I need to rewrite the destination address to a specific local address no matter what local address it is actually addressed.
I saw this for using header_checks https://serverfault.com/questions/284702/redirect-specific-e-mail-address-sent-to-a-user-to-another-user:
You can use PCRE In /etc/postfix/main.cf:
header_checks = pcre:/etc/postfix/headers_check
/etc/postfix/headers_check:
/To:.*@(?!mail.domain.com) && From:.*@?!extdomain.com/ REDIRECT ***@mail.other.domain.com
PCRE works with perl regular extentions, and you can specify any conditions.
But someone commented:
The voted answer will not work because postfix checks one header at a time, as the manual clearly states. postfix.org/header_checks.5.html
I checked the manual page and it does state that checks are made one header at a time, so I don't think checking for To and From in the test would work. I have not tried it.
I know address rewriting is at the heart of Postfix, but I just have not found a solution in the documentation, this list, or the How Tos.
Sure would appreciate a helping hand with this.