Go to the first, previous, next, last section, table of contents.


34 Customizing error and warning messages

When a message fails to get delivered, or remains on the queue for more than a configured amount of time, Exim generates an 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.

34.1 Customizing error messages

If `errmsg_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 `errmsg_file' is set.

When `errmsg_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: `$errmsg_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 (`errmsg_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. -------------------------------------------------------------------------


>>>>>>> .linelength 80em

Subject: Mail delivery failed
  ${if eq{$sender_address}{$errmsg_recipient}{: returning message to sender}}
****
This message was created automatically by mail delivery software.

A message ${if eq{$sender_address}{$errmsg_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.
****

-------------------------------------------------------------------------

34.2 Customizing warning messages

The option `warnmsg_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 file -------------------------------------------------------------------------


>>>>>>> .linelength 80em

Subject: Warning: message $message_id delayed $warnmsg_delay
****
This message was created automatically by mail delivery software.

A message ${if eq{$sender_address}{$warnmsg_recipients}{that you sent }{sent by

  <$sender_address>

}}has not been delivered to all of its recipients after
more than $warnmsg_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, `$warnmsg_delay' is set to the delay time in one of the forms `<n> minutes' or `<n> hours', and `$warnmsg_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/directors that handled them.


Go to the first, previous, next, last section, table of contents.