procmail vacation messages

Hans Fugal hans at fugal.net
Tue Jul 11 16:36:06 MDT 2006


On Tue, 11 Jul 2006 at 16:33 -0600, Michael L Torrie wrote:
> I know that vacation (out-of-office replies) have fallen out of favor
> these days, but I have a user that wants to set one.  Back in the olden
> days /usr/bin/vacation was just a part of the system.  Now it doesn't
> seem to be available.  What solutions do you recommend for implementing
> a vacation message that works with procmail?  Any suggestions are
> appreciated.
> 
> thanks.
> 
> Michael

man procmailex

    A  more  complicated  autoreply  recipe  that implements the functional
    equivalent of the well known vacation(1) program.  This recipe is based
    on  the  same  principles as the last one (prevent `ringing' mail).  In
    addition to that however, it maintains a vacation database by  extract-
    ing  the name of the sender and inserting it in the vacation.cache file
    if the name was new (the vacation.cache file is maintained  by  formail
    which will make sure that it always contains the most recent names, the
    size of the file is limited to a maximum of approximately 8192  bytes).
    If the name was new, an autoreply will be sent.

    As  you  can  see, the following recipe has comments between the condi-
    tions.  This is allowed.  Do not put comments on the  same  line  as  a
    condition though.

	    SHELL=/bin/sh    # for other shells, this might need adjustment

	    :0 Whc: vacation.lock
	    # Perform a quick check to see if the mail was addressed to us
	    * $^To:.*\<$\LOGNAME\>
	    # Don't reply to daemons and mailinglists
	    * !^FROM_DAEMON
	    # Mail loops are evil
	    * !^X-Loop: your at own.mail.address
	    | formail -rD 8192 vacation.cache

	    :0 ehc         # if the name was not in the cache
	    | (formail -rI"Precedence: junk" \
		    -A"X-Loop: your at own.mail.address" ; \
		echo "I received your mail,"; \
		echo "but I won't be back until Monday."; \
		echo "-- "; cat $HOME/.signature \
		) | $SENDMAIL -oi -t

-- 
Hans Fugal ; http://hans.fugal.net
 
There's nothing remarkable about it. All one has to do is hit the 
right keys at the right time and the instrument plays itself.
    -- Johann Sebastian Bach
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://plug.org/pipermail/plug/attachments/20060711/a03e4707/attachment.pgp


More information about the PLUG mailing list