Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Redirect email from incoming address to specific local email address

96 views
Skip to first unread message

John G

unread,
Feb 3, 2019, 4:47:51 PM2/3/19
to
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 mai...@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

unread,
Feb 5, 2019, 7:59:04 PM2/5/19
to
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.

user@domain REDIRECT user2@anotherDomain

Simple.
0 new messages