Category Archives: mail

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 で転送失敗のメールを送信者に知らせたくない

Setting the maximum send / receive size of Postfix

/etc/postfix/main.cf

message_size_limit = 20480000

The default when message_size_limit is not specified is 10240000 (10MB).

For complete parameter list of main.cf, see the postconf(5) man page.

$ man 5 postconf
message_size_limit (default: 10240000)
       The maximal size in bytes of a message, including envelope information.

Caution

Be careful when changing message_size_limit.
message_size_limit must not be larger than mailbox_size_limit.
If message_size_limit is larger than mailbox_size_limit、you can't receive any messages.

The default of mailbox_size_limit is 51200000 (50MB).
Zero means no limit.

mailbox_size_limit = 0
mailbox_size_limit (default: 51200000)
       The  maximal  size  of any local(8) individual mailbox or maildir file, or zero (no limit).  In fact, this limits the size of any
       file that is written to upon local delivery, including files written by external commands  that  are  executed  by  the  local(8)
       delivery agent.

       This limit must not be smaller than the message size limit.