procmail
[Top] [All Lists]

Re: [Q] both vacation and procmail - how?

1996-12-19 09:22:14
Peter Gjefle <pg(_at_)sn(_dot_)no> writes:
..of course i am leaving for christmas,
and like everyone else i want to set up an autoreply.

i am used too using the vacation program. for the first time i want
to leave procmail running, still using the vacation program.


All three of the things you tried can be made to work.  Choose one
of them and use it, but don't try to combine them.


here is what i have tried:
 1    ackmail.rc      ->error because formail cannot open

Assuming you actually have a copy of ackmail.rc (do you?), what's the
literal error message when you try to use it?


 2    procmail recipe:
      :0
      | /usr/ucb/vacation     ->executes (logg says), but nothing happens

What were you expecting it to do?  Vacation is expecting you to save
the message in some other way, and does not do so itself.  All it does
is check a database, examine some headers, and if the checks 'pass'
then it sends a reply back.  Pretty basic.  You can implement the same
thing in procmail in 2 recipes (see below).


 3    double .forward
      "|/usr/ucb/vacation && exec /usr/local/bin/procmail -f- || exit 75 #pg"
      -> -nothing-, loop maybe??

I repeat, vacation only sends replies; it never saves messages.  The
above should read:

"|/usr/ucb/vacation", "exec /usr/local/bin/procmail -f- || exit 75 #pg"




Personally I'd option 1: not using vacation at all.  I'm not personally
familiar with ackmail.rc (though I have heard good things about it),
but I will say that if you can't get it to work you can always
implement the needed functionality yourself.  For example, I use a
tweaked version of the example from the procmailex(5) manpage, kept in
$HOME/.procmailrc.vacation, that looks like this:


# Do a vacation like program
:0 Whc: vacation.lock
*   ^TO_guenther@
* ! ^FROM_DAEMON
* ! ^X-Loop: guenther(_at_)gac(_dot_)edu
| formail -rD 8192 vacation.cache

:0 ehc                  # if the name was not in the cache
| ( formail -ri"Precedence: junk" -A"X-Loop: guenther(_at_)gac(_dot_)edu" ; \
        cat $HOME/.vacation.msg \
      ) | $SENDMAIL -oi -t



Right before I disappear for a while, I update .vacation.msg to
accurately document when I'll be back, zero out vacation.cache, then
uncomment INCLUDERC=$HOME/.procmailrc.vacation in my .procmailrc file.
Then I forget about computers for an altogether too short a period of
time...

The above sends a response with a subject of "re: original subject",
while I think most vacation programs use a fixed subject.  If you
prefer the fixed subject, you can just a

        -I"Subject: vacation (not!) response"

to the formail command line.  The above recipe also does not handle the
$SUBJECT expansion that vacation does.  This is easy to add: just
replace the second recipe with the following nested recipe:

:0 e
{
    # Get the current subject, trimming spaces from both ends.  It's
    # saved in MATCH
    :0
    * ^Subject: *\/[^ ].*[^ ]
    { }

    # Send the reply
    :0 hc
    | ( formail -ri"Precedence: junk" -A"X-Loop: guenther(_at_)gac(_dot_)edu" ; 
\
            sed "s:\\\$SUBJECT:$MATCH:" < $HOME/.vacation.msg \
          ) | $SENDMAIL -oi -t
}


You can even incorporate the old subject into a fixed subject plan,
by saying something like:

:0 e
{
    # If the original message had no Subject: line, or it was blank, what
    # do we use?
    SUBJECT="vacation response"

    :0
    * ^Subject: *\/[^ ].*[^ ]
    { SUBJECT = "vacation response (WAS: $MATCH)" }

    :0 hc
    | ( formail -ri"Precedence: junk" -A"X-Loop: guenther(_at_)gac(_dot_)edu" \
            -I"Subject: $SUBJECT"; \
            sed "s:\\\$SUBJECT:$SUBJECT:" < $HOME/.vacation.msg \
          ) | $SENDMAIL -oi -t
}


The point is that a vacation written in procmail is as configurable as
you want.  If the above example seem overly mysterious or complicated,
then you should just use the ackmail.rc recipes, as they're documented
more fully than the recipes above.  I will caution you: make sure you
understand the requirements of whatever you use enough that a) when you
get back you can disable it, and b) next vacation you can remember how
to enable it!

Philip Guenther

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