With Postfix it is possible with an entry in main.cf (virtual_alias_maps = hash:/etc/postfix/virtual) and an additional file (here /etc/postfix/virtual) to forward e-mails depending on the recipient.

My question is, how can e-mails be forwarded to a specific address depending on the sender and recipient? There are no local users/e-mail recipients on the server.

An example: E-mails from [email protected] to [email protected] should be forwarded to [email protected]. Can someone help me with this question?

  • A milter could do this, with the downside of the complexity of a milter (also what happens when the message is to multiple folks?)
    – thrig
    Sep 20, 2017 at 20:22
  • In this case, the email should be forwarded to [email protected] and all other recipients, but not to [email protected].
    – Cyrus
    Sep 20, 2017 at 20:31
  • Sieve can do this. I assume there's a Sieve plug-in for Postfix delivery Sep 24, 2017 at 20:08
  • 1
    You could consider using procmail, perhaps in your ~/.forward Sep 25, 2017 at 7:23
  • @BasileStarynkevitch: Since it is only about one recipient ([email protected]), that would be a possibility.
    – Cyrus
    Sep 25, 2017 at 7:32

1 Answer 1


Postfix by itself CANNOT.


Header/body checks cannot depend on the recipient of a message.

One message can have multiple recipients, and all recipients of a 
message receive the same treatment. Workarounds have been proposed that 
involve selectively deferring some recipients of multi-recipient mail, 
but that results in poor SMTP performance and does not work for non-
SMTP mail.

Some sources of mail send the headers and content ahead of the 
recipient information. It would be inefficient to buffer up an entire 
message before deciding if it needs to be filtered, and it would be 
clumsy to filter mail and to buffer up all the actions until it is 
known whether those actions need to be executed.

You need a milter.

  • Thanks for this information. I can see it's getting more complicated.
    – Cyrus
    Sep 25, 2017 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .