Skip to main content
2 of 2
added 87 characters in body

Rewriting from header when forwarding email using Postfix

I'm sending email using Postfix on my Debian server, which is working fine.

Now I want to receive email by forwarding all incoming email to my email address (which is not on this server). I got this working using the following config:

/etc/postfix/virtual:

/.+@.+/ [email protected]

/etc/postfix/main.cf:

virtual_maps = regexp:/etc/postfix/virtual

This forwards all incoming email to my email address, which is working. However, this forwards email using the From header of the original email, which I don't want because it may get my IP address on a blacklist.

How can I rewrite the From header of all forwarded emails to something like [email protected]?

I tried using a regex to rewrite all domains that are not mine to [email protected], but since I'm not so good at regex I can't get it working. I also tried setting remote_header_rewrite_domain to my.domain but that doesn't change anything.

If possible, I would like to just set the Sender header for all forwarded emails.