I hate vacation messages but business people tend to want them. They’re easy to do by the user on Exchange but it’s a bit harder on pure IMAP/POP based services since it’s not all integrated into one with the mail client.
Exim can do vacation messages using its Autoreply Transport. It supports all the usual stuff like only notifying a specific sender once every couple of days etc.
To get this going requires two bits of config, first you need a router. Routers in the exim configuration is processed top-down as they appear in the config file, so you’ll want to put the vacation handling above any localuser handling, virtual hosting etc.
A sample router is shown below, it’s for local users and they just have to put a .vacation file in their home directory to activate the functionality, the .vacation file should contain the text they want mailed. You can easily adapt the location of this to be in your virtual mail hierarchy by changing the file locations below:
uservacation: driver = accept domains = +local_domains require_files = $home/.vacation # do not reply to errors or lists condition = ${if or { \ {match {$h_precedence:} {(?i)junk|bulk|list}} \ {eq {$sender_address} {}} \ } {no} {yes}} # do not reply to errors or bounces or lists senders = ! ^.*-request@.*:\ ! ^bounce-.*@.*:\ ! ^.*-bounce@.*:\ ! ^owner-.*@.*:\ ! ^postmaster@.*:\ ! ^webmaster@.*:\ ! ^listmaster@.*:\ ! ^mailer-daemon@.*:\ ! ^root@.* no_expn transport = uservacation_transport unseen no_verify
You’ll notice that it does not autoreply to certain people, the kind of from addresses that mailing lists typically use, it will also ignore bounce messages.
Once you have the router configured you’ll need a transport, this will call the autoreply transport and do the hard work. It will use a Berkley style database in ~/.vacation.db to store the list of people it has contacted in the last 14 days. Users can just delete this file if they want to reset it all.
uservacation_transport: driver = autoreply file = $home/.vacation file_expand once = $home/.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 to = $sender_address subject = "Re: $h_subject"
That should do it, in a virtual domain setup you could easily integrate this into a web interface that maintains the text files required, there are other features like a standard prefix before each vacation message etc, refer to the Exim Documentation for details on these.
Surely this is the point of sieve? Using sieve you can let your users create their own vacation message, set up forwards, and do all sorts of cute mail filtering things.
The Horde/IMP webmail client has built-in support for sieve in the form of Ingo, which is a nice web-based editor for sieve rules. There are a few other web-based editors available, and if none of them tickle your fancy there’s a Perl module to integrate sieve into other things.
hey,
ah, well I wasn’t aware of sieve all my searching didn’t find much mention of it 🙂 Eitherway, mine are all virtual users who don’t have access to the box in question so I need to maintain them some other way, sieve though does seem interesting will check it out.
thanks
I think you need to add ‘check_local_user’ to your router; check_local_user is needed to set $home to the users home directory; without it, it’ll get set to either roots home directory, or exims – I’m unsure which.
No, not check_local_user, since these are virtual users. There needs to be a transport_home_directory line in the router.
It’s probably better to use this for your from address:
from = Autoreply System
That way if a user mailed alias@domainalias.foo the reply will originate from the same address.
-Jaco
Has anyone got a clue how does this work with split configs i cannot get it workin update-exim4.conf does not give any errors but sender doesn’t get a reply.
—
Arva
Somehow this wont work for me. Exim somehow skips vacation processing even thought the vacation.msg file exists