Prevent an error mail from being sent to the original sender in the case of forwarding failure on Postfix

On Postfix, in the case of forwarding by aliases or .forward, if the forwarding results in an error, the error mail is sent to the original sender. The most easy way to prevent this behavior is setting the alias to a redirection to sendmail command and changing envelope sender address using sendmail -f option like below.

| /usr/sbin/sendmail -f <envelope sender address> <recipient address to forward>

Example:

/etc/aliases

foo: foo, "| /usr/sbin/sendmail -f bar xxx@example.com"

sendmail -f option sets the envelope sender address. This is the address where delivery problems are sent to ("bar" in the above example). This means that an error mail is not delivered to the original sender.

Be careful not to create infinite loop
In the above example, you should be careful that foo does not come to be the last recipient.

[postfix-jp:01469] Re: [Q] .forward で転送失敗のメールを送信者に知らせたくない

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.