Previous   Next   Contents       (Exim 4.40 Specification)

41. Customizing bounce and warning messages

When a message fails to be delivered, or remains on the queue for more than a configured amount of time, Exim sends a message to the original sender, or to an alternative configured address. The text of these messages is built into the code of Exim, but it is possible to change it, either by adding a single string, or by replacing each of the paragraphs by text supplied in a file.

The From: and To: header lines are automatically generated; you can cause a Reply-To: line to be added by setting the errors_reply_to option. Exim also adds the line

  Auto-Submitted: auto-generated

to all warning and bounce messages,

41.1. Customizing bounce messages

If bounce_message_text is set, its contents are included in the default message immediately after “This message was created automatically by mail delivery software.” The string is not expanded. It is not used if bounce_message_file is set.

When bounce_message_file is set, it must point to a template file for constructing error messages. The file consists of a series of text items, separated by lines consisting of exactly four asterisks. If the file cannot be opened, default text is used and a message is written to the main and panic logs. If any text item in the file is empty, default text is used for that item.

Each item of text that is read from the file is expanded, and there are two expansion variables which can be of use here: $bounce_recipient is set to the recipient of an error message while it is being created, and $return_size_limit contains the value of the return_size_limit option, rounded to a whole number.

The items must appear in the file in the following order:

The default state (bounce_message_file unset) is equivalent to the following file, in which the sixth item is empty. The Subject: line has been split into two here in order to fit it on the page:


  Subject: Mail delivery failed
    ${if eq{$sender_address}{$bounce_recipient}{: returning message to sender}}
  ****
  This message was created automatically by mail delivery software.
  
  A message ${if eq{$sender_address}{$bounce_recipient}{that you sent }{sent by
  
    <$sender_address>
  
  }}could not be delivered to all of its recipients.
  The following address(es) failed:
  ****
  The following text was generated during the delivery attempt(s):
  ****
  ------ This is a copy of the message, including all the headers. ------
  ****
  ------ The body of the message is $message_size characters long; only the first
  ------ $return_size_limit or so are included here.
  ****

41.2. Customizing warning messages

The option warn_message_file can be pointed at a template file for use when warnings about message delays are created. In this case there are only three text sections:

The default state is equivalent to the following file, except that the line starting “A message” has been split here, in order to fit it on the page:


  Subject: Warning: message $message_id delayed $warn_message_delay
  ****
  This message was created automatically by mail delivery software.
  
  A message ${if eq{$sender_address}{$warn_message_recipients}
    {that you sent }{sent by
  
    <$sender_address>
  
  }}has not been delivered to all of its recipients after
  more than $warn_message_delay on the queue on $primary_hostname.
  
  The message identifier is:     $message_id
  The subject of the message is: $h_subject
  The date of the message is:    $h_date
  
  The following address(es) have not yet been delivered:
  ****
  No action is required on your part. Delivery attempts will continue for
  some time, and this warning may be repeated at intervals if the message
  remains undelivered. Eventually the mail delivery software will give up,
  and when that happens, the message will be returned to you.

except that in the default state the subject and date lines are omitted if no appropriate headers exist. During the expansion of this file, $warn_message_delay is set to the delay time in one of the forms “<n> minutes” or “<n> hours”, and $warn_message_recipients contains a list of recipients for the warning message. There may be more than one if there are multiple addresses with different errors_to settings on the routers that handled them.


Previous  Next  Contents       (Exim 4.40 Specification)