Rewriting from header when forwarding email using Postfix

emailpostfix

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:

/.+@.+/ my@email.address

/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 forwarder@my.domain?

I tried using a regex to rewrite all domains that are not mine to forwarder@my.domain, 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.

Best Answer

Rewriting the From header field would not help with protecting your ip address from getting blacklisted when the receiver of that mail marks it as spam as your ip address will still be the one that transmitted that e-mail, but might make the receiver realize it is being forwarded.

You can use postfix header_checks feature to rewrite the From header. 1

Forwarding also breaks SPF and this article might give you another perspective into the same problem

Related Question