Skip to content
Nigel Metheringham edited this page Nov 29, 2012 · 2 revisions

Q0413


`Navigation(siblings)`_


Q0413

Question

When a user's .forward file is syntactially invalid, Exim defers delivery of all messages to that user, which sometimes include the user's own test messages. Can it be told to ignore the .forward file and/or inform the user of the error?

Answer

Setting skip_syntax_errors on the redirect router causes syntax errors to be skipped. When dealing with users' .forward files it is best to combine this with a setting of syntax_errors_to in order to send a message about the error to the user. However, to avoid an infinite cascade of messages, you have to be able to send to an address that bypasses .forward file processing. This can be done by including a router like this one

real_localuser:
  driver = accept
  check_local_user
  transport = local_delivery
  local_part_prefix = real-

before the redirect router that handles .forward files. This will do an ordinary local delivery without .forward processing, if the local part is prefixed by real-. You can then set something like the following options on the redirect router:

skip_syntax_errors
syntax_errors_to = real-$local_part@$domain
syntax_errors_text = "\
  This is an automatically generated message. An error has been \
  found\nin your .forward file. Details of the error are reported \
  below. While\nthis error persists, messages addressed to you will \
  get delivered into\nyour normal mailbox and you will receive a \
  copy of this message for\neach one."

A final tidying setting to go with this is a rewriting rule that changes real-username into just username in the headers of the message:

\N^real-([^@]+)@your\.dom\.ain$\N    [email protected]   h

This means that users won't ever see the real- prefix, unless they look at the Envelope-To: header.


Clone this wiki locally