Discussion:
Redirect email from incoming address to specific local email address
(too old to reply)
John G
2019-02-03 21:47:50 UTC
Permalink
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.
John G
2019-02-06 00:59:02 UTC
Permalink
I "solved" it.

I was living in the past and thought access table would only accept or reject email from a user, domain, IP, etc. Since Postfix 2.1 (that's a long time ago), ACCESS will REDIRECT. That will teach me to read the docs even for stuff I used to know.

Glad it is a virtue to admit one's mistakes.

This added to the access data table works.

***@domain REDIRECT ***@anotherDomain

Simple.

Continue reading on narkive:
Loading...