Answer the question
In order to leave comments, you need to log in
Postfix: how to forward incoming emails from specific addresses to only one recipient?
Hello colleagues.
I don’t know how to write briefly the essence of the issue ... I will describe in detail.
There is a mail server with postfix - mail.example.org. There is a [email protected] mailbox on the server. You need to set up forwarding of incoming messages from this mailbox to the [email protected] mailbox, provided (!) that the letter was sent from one of the specified mailboxes, for example, from [email protected] or from [email protected] If the incoming letter is from any other address, then forwarding is not necessary.
In other words... If a letter arrives at [email protected], the sender of which is [email protected] or from [email protected], then forward (copy) it to [email protected]
Is it possible and how to implement such a forwarding scheme?
Answer the question
In order to leave comments, you need to log in
procmail
SENDER="<$1>"
SHIFT=1
:0 c
* ^To:.*[email protected]
{
:0 c
* ^From:.*[email protected]
! -oi -f "$SENDER" [email protected]
:0
* ^From:.*[email protected]
! -oi -f "$SENDER" [email protected]
}
:0
! -oi -f "$SENDER" "[email protected]"
I will suggest the following solution:
to the file /etc/postfix/main.cf the line:
header_checks = pcre:$additional_config_dir/header_checks.pcre
Create this file /etc/postfix/config/header_checks.pcre containing the line:
/From: .*[email protected] server1\.ru*?\nTo: .*[email protected]\.ru/m REDIRECT [email protected] Postfix
reload
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question