[EXIM] Vacation facility with no local users

Pàgina inicial
Delete this message
Reply to this message
Autor: Richard Gilbert
Data:  
A: exim-users
Assumpte: [EXIM] Vacation facility with no local users
I was asked recently whether there was an auto-reply facility by a user
who was going away for a period. He does not have a Unix account and
normally reads it with Pegasus Mail for Windows. We do not recommend the
use of the auto-reply facilities provided by Pegasus which, as far as I
know, require the PC to be left on with Pegasus running. The auto-reply
facility is also not "intelligent" in the same way that /usr/ucb/vacation
is.

This made me wonder about providing a central intelligent vacation
facility with Exim. (I am still using 2.03.) Exim already provides a
"once" facility with the autoreply transport but I also wanted to apply
the additional /usr/ucb/vacation conditions, viz. don't reply unless the
recipient's address appears in the To: or Cc: fields, and don't reply if
the From: field contains '-request' or the message precedence is bulk or
junk. It seemed to me that these extra conditions could only be applied by
using the condition option on a director.

The way I envisage the facility being used is that the user gets an extra
(local) delivery address via the aliases file, e.g.

R.Gilbert: cs1jrg@???,vacation-cs1jrg

There is a vacation directory which contains a lookup file with an entry
for each of the users who need the facility, e.g.

vacation-cs1jrg: r\.gilbert@shef(field)?\.ac\.uk

where the RHS (returned in $local_part_data) is a regular expression which
is used when checking the To: and Cc: fields for the recipient's address.
The directory also has to contain a message for that user, e.g.
cs1jrg.msg.

One of the problems which I needed to deal with is that the local delivery
of the vacation-username address has to succeed even if the vacation_reply
director condition is not satified, so this led to a second director for
the vacation- prefix which will always succeed and use a second transport
to deliver the message to /dev/null.

The gory details are appended. I have tested it fairly thoroughly and
seems to work as desired, but I would welcome any feedback on better (and
simpler?) ways to achieve the same effect. I would also be very pleased
if it is of any use to any one else.

Richard
--
Richard Gilbert
Corporate Information and Computing Services
University of Sheffield, Sheffield, S10 2TN, UK
Phone: +44 114 222 3028 Fax: +44 114 222 3040

Directors
---------

vacation_users_1:
driver = smartuser
prefix = vacation-
local_parts = lsearch;/var/spool/exim/tables/vacation/usernames
require_files = /var/spool/exim/tables/vacation/${local_part}.msg
# The following condition is all one long line but is split here for readability (sic!)
condition = ${if and{
{or{{match{${lc:$header_to:}}{$local_part_data}}{match{${lc:$header_cc:}}{$local_part_data}}}}
{!eq{$sender_address}{}}
{!match{${lc:$header_from:}}{-request}}
{!match{${lc:$message_precedence}}{bulk|junk}}}
{yes}{no}}
transport = vacation_reply
no_verify

vacation_users_2:
driver = smartuser
prefix = vacation-
transport = vacation_no_reply
no_verify

Transports
----------

vacation_reply:
driver = autoreply
from = ${local_part}@???
to = $sender_address
subject = Auto-reply re: $header_subject:
file = /var/spool/exim/tables/vacation/${local_part}.msg
return_message
once = /var/spool/exim/tables/vacation/${local_part}
log = /var/spool/exim/tables/vacation/${local_part}.log
user = exim

vacation_no_reply:
driver = appendfile
file = /dev/null
user = exim




--
*** Exim information can be found at http://www.exim.org/ ***