With a little side of applesauce...

Friday, February 9, 2007

Exim4 - vacation messages

Add the following router to:
router/600_exim4-config_userforward:

# This router delivers a "vacation" message if a file called 'vacation.msg'
# exists in the home directory.
uservacation:
driver = accept
domains = +local_domains
# user to put away message in a file called vacation.msg
require_files = /home/${local_part}/vacation.msg
# do not reply to errors or lists or with ADV in the subject
condition = ${if or { \
{match {$h_precedence:} {(?i)junk|bulk|list}} \
{eq {$sender_address} {}} \
{match {$h_subject:} {(ADV|Adv)}} \
} {no} {yes}}
no_expn
# do not reply to errors or bounces or lists
senders = ! ^.*-request@.*:\
! ^bounce-.*@.*:\
! ^.*-bounce@.*:\
! ^owner-.*@.*:\
! ^postmaster@.*:\
! ^webmaster@.*:\
! ^listmaster@.*:\
! ^mailer-daemon@.*:\
! ^root@.*
transport = uservacation_transport
unseen
no_verify


Add the following transport:
transport/30_exim4-config_address_pipe

# This transport is used for vacation messages
uservacation_transport:
driver = autoreply
file = /home/${local_part}/vacation.msg
file_expand
# if using MailScanner setup with two config files
# must be able to write as the user exim runs as
# because calling with -C will not run as root
# http://www.exim.org/pipermail/exim-users/Week-of-Mon-20020715/041328.html
# once = /var/log/exim/vacation/$local_part-vacation.db
# if not using MailScanner setup try something like
once = /home/${local_part}/.vacation.db
# to use a flat file instead of a db specify once_file_size
#once_file_size = 2K
once_repeat = 14d
from = $local_part@domain.com
to = $sender_address
subject = "Re: $h_subject"
# text that will be included in message above what is in user's vacation.msg
text = "This is an automatic reply. Please feel free to send additional\n\
mail, as only this one notice will be generated.\n\
================================================\n\n"
#...


Install the vacation package:
apt-get install vacation

Initialize your vacation database:
me@mymail:~$ vacation
This program will answer your mail automatically when you go away on vacation.
You need to put in the ~/.vacation.msg file the reply message.
Would you like to create it (y/N)? y
To enable the vacation program a '~/.forward' file is created.
Would you like to enable the vacation program (y/N)? y
You have a '~/.forward' file containing:

|/usr/bin/procmail

It needs to be renamed before the vacation program can be enabled.
Do you want to proceed (y/N)? y
The vacation program is ENABLED.
me@mymail:~$ cat .forward
\me, "|/usr/bin/vacation me"
me@mymail:~$ emacs .vacation.msg
Subject: RE: $SUBJECT

I am on vacation until....

Thanks!
me

You can then run vacation again to turn it off...

No comments: