procmail
[Top] [All Lists]

Re: Vacation

2009-11-16 20:02:06
(forgive the late reply, but while I've been continuously subscribed
to procmail@ since forever, I haven't kept up very well in the past
half decade ...)

Sean wrote:

From my 13 year old implementation (which hasn't been used since I went on 
a vacation in 1996, though I've been on vacations since then <g>), with a  
couple of tweaks:

# Vacation mail handling.

VACATIONFILE=$HOME/path/to/flag/file
ALREADYSENT=$HOME/.vacation.cache
VACATIONMSG=$HOME/path/to/autoreply/text

# first, do this ONLY if the vacation file is present (allows you to
# externally toggle vacation on and off) and if this isn't a daemon message
# we also check that the LISTNAME variable is EMPTY (presumes use of listid.rc
# or similar)
:0
* ? test -e $VACATIONFILE
* !^FROM_DAEMON
* LISTNAME ?? ^^^^
{
        # if vacation is in effect, get the reply to address (NOT simply  
From:
        # because it'd be rude to send something there)
        :0 h
        REPLYTO=|formail -rtzxTo:

        # then, check to see if that address is in the address cache, and
        # if not, then send an autoreply.
        :0 ch:  # the lockfile is important
        * !? fgrep -s -e "$REPLYTO" $ALREADYSENT
        | echo $REPLYTO >> $ALREADYSENT; \
                (formail -rA "Precedence: notification" ;\
                cat $VACATIONMSG) | $SENDMAIL -t
}

From my "hasn't been used in years" version of a vacation.rc file <grin>:

  :0 Whc: vacation.lock         # Put the email address in a cache file
  | formail -rD 8192 $PROCS/.vacation.cache

  :0 ehc
  [insert sending recipe here]

formail's barely documented trick of caching from_ addresses instead
of Message-IDs.

Reto
-- 
R A Lichtensteiger      rali(_at_)tifosi(_dot_)com


    Driscoll's Observation: The product of the IQs of each member of a
                            tech-support conversation is a constant.
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>