Previous   Next   Contents       (Exim Filter Specification)

28. Testing for personal mail

A common requirement is to distinguish between incoming personal mail and mail from a mailing list. In particular, this test is normally required for so-called ``vacation messages''. The condition

   personal

is a shorthand for

   !error_message and
   $header_to: contains "$local_part@$domain" and
   $header_from: does not contain "$local_part@$domain" and
   $header_from: does not contain "server@" and
   $header_from: does not contain "daemon@" and
   $header_from: does not contain "root@" and
   $header_subject: does not contain "circular" and
   $header_precedence: does not contain "bulk" and
   $header_precedence: does not contain "list" and
   $header_precedence: does not contain "junk"

The variable $local_part contains the local part of the mail address of the user whose filter file is being run - it is normally your login id. The $domain variable contains the mail domain. This condition tests for the appearance of the current user in the To: header, checks that the sender is not the current user or one of a number of common daemons, and checks the content of the Subject: and Precedence: headers.

If prefixes or suffixes are in use for local parts - something which depends on the configuration of Exim (see section 31 below) - the first two tests above are also done with

  $local_part_prefix$local_part$local_part_suffix

instead of just $local_part. If the system is configured to rewrite local parts of mail addresses, for example, to rewrite ``dag46'' as ``Dirk.Gently'', the rewritten form of the address is also used in the tests.

This example shows the use of personal in a filter file that is sending out vacation messages:

  if personal then
    mail
     to $reply_address
     subject "Re: $h_subject:"
     file $home/vacation/message
     once $home/vacation/once
     once_repeat 10d
  endif

It is quite common for people who have mail accounts on a number of different systems to forward all their mail to one system, and in this case a check for personal mail should test all their various mail addresses. To allow for this, the personal condition keyword can be followed by

  alias <address>

any number of times, for example

  if personal alias smith@else.where.example
              alias jones@other.place.example
  then ...

This causes messages containing the alias addresses in any places where the local address is tested to be treated as personal.


Previous  Next  Contents       (Exim Filter Specification)