I have a virtualmin / webmin server setup. Some domains don't want to receive emails directly to their domains. So I have setup a server-side forward to their Gmail adresses.

The forwarding works, and the emails are delivered to the Gmail mail boxes. However, the FROM address in the email headers are the same as the original sender. This results in the forwarded messages (sometimes) are flagged as spam by some mail providers.

Is there a Postfix or virtualmin setting that 'replaces' the FROM header with the email address of the domain that did the forwarding? Just like the behaviour that normal email clients (like Thunderbird) do. In Thunderbird, when I receive a message that I want to forward, I right-click and select 'forward' from the dropdown and it automatically sets MY own email address in the 'From' field.


sender_canonical_maps (default: empty)

Optional address mapping lookup tables for envelope and header sender addresses. The table format and lookups are documented in canonical(5).

Example: you want to rewrite the SENDER address "user@ugly.domain" to "user@pretty.domain", while still being able to send mail to the RECIPIENT address "user@ugly.domain".

Note: $sender_canonical_maps is processed before $canonical_maps.

Example: sender_canonical_maps = hash:/etc/postfix/sender_canonical

Source : http://www.postfix.org/postconf.5.html#sender_canonical_maps

  • Yes, i have seen the 'sender_canonical_maps' in the documentation. But there are 2 problems here... I only need to 'rewrite' the sender adres for a email that is being forwarded by the server itself. And problem 2 is that i dont know the email adressen to a map... for example, if it was in PHP, i need this: if($forward == true) $sender = $myEmailAddress: – Rubentje Apr 21 '18 at 9:14
  • And with 'forwarded by the server itself', I mean this: i have the domain example.com on my server. I created the virtualmin user info@example.com. This user does not want that the emails are being saved on this server. So instead, all emails that are delivered to info@example.com are immediately forwarded to user@domain2.com. – Rubentje Apr 21 '18 at 9:24
  • then /etc/aliases should be enough, no need to create the virtualuser – bgtvfr Apr 23 '18 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.