Configuring Vacation Mail With Procmail

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.