Configuring Unix CS mail Vacation With Procmail

PLEASE NOTICE: From 20/9/2022 access to CS Unix mail is possible only from inside Technion network (CS or Technion SSLVPN)

This procedure is to setup Email vacation (Out Of  The Office) reply Email for Unix email account that uses procmail to filter messages. To setup vacation (Out Of  The Office) for Unix Email account without procmail, please see  Mail Automatic reply (Unix vacation) .

Continue from here if you have procmail setup in your Email account.

To add a vacation to all send mail (even filtered procmail emails):

  1. Save the .forward with the promail line (cp –p .forward .forward.REM-procmail).
  2. run the vacation from Webmail or from command.
  3. edit .forward and add the procmail line:

|/usr/bin/procmail

“|/usr/bin/vacation my-username”

Done.

 

Configure vacation using procmail only without vacation utility for non filtered only (not recommended):

If you use procmail to filter messages, you need to setup vacation email response via your .procmailrc file in your homedir rather than the vacation program.
This is because email responses will not then be sent to senders whose emails are to be filtered, which is desirable because the sender doesn’t get to know that the email address was successful. Spammers use such replies to build databases of live email addresses.

Configure procmail as follows:

  1. Add this to the end of your .procmailrc file in your homedir:# Uncomment this line when you go away to send a message
    # you have saved as $HOME/.vacation.msg
    #INCLUDERC=$HOME/.procmail/rc.vacation
  2. Create the file $HOME/.procmail/rc.vacation in your homedir and put the following lines in it :

:0 Whc: vacation.lock
# Reply if mail is addressed to me.
# Don’t reply to daemons or mailing lists.
# Avoid mail loops (don’t reply to mail I might send myself).
* $^To:.*\<$\LOGNAME\>
* !^FROM_DAEMON
* !^X-Loop: $LOGNAME@cs.technion.ac.il
# Store sender’s address in vacation.cache if not there already.
| /usr/bin/formail -rD 8192 $HOME/.vacation.cache
# If sender’s address not in cache (e=previous recipe failed), send
# mail containing vacation message.  Note:  Trailing backslashes (\)
# required to denote continuation of single action line.
:0 ehc
 | (/usr/bin/formail -rA”Precedence: junk” \
 -A”X-Loop: $LOGNAME@cs.technion.ac.il” ; \
 cat $HOME/.vacation.msg \
 ) | /usr/lib/sendmail -oi -t

 

You are now ready.

In order to setup a vacation email response each time you go away, do the following:

  1. Edit your vacation message file .vacation.msg  in homedir as appropriate. This file may not contain any variables such as $SUBJECT or $DATE. It should be text only.
  2. Remove the file .vacation.cache in homedir if it exists. This file cache all emails that where already answered by the vacation, so you need to delete it every time you want to start new vacation.
  3. To start the vacation, uncomment  (remove # at start) this line in your .procmailrc file in homedir:
    #INCLUDERC=$PMDIR/rc.vacation

Check it by sending mail to your cs mail and see that you get it and also the vacation message is sent back.

 

To stop the vacation response do:

  1. In your homedir file .procmailrc, comment out the line (put # at start)

        INCLUDERC=$HOME/.procmail/rc.vacation

So it will look like this:

        #INCLUDERC=$HOME/.procmail/rc.vacation

  1. Remove the file .vacation.cache in homedir if it exists. Notice that in this file you can find the list of addresses that where responded by the vacation recipe.

That’s it.

Check it by sending mail to your cs mail and see that you get it and also the vacation message is NOT sent back.

 

Please notice that you must not use vacation command at any time because it will override .forward file and will disable procmail utility.