procmail
[Top] [All Lists]

Forward Mail Spool on Demand

2003-06-21 02:10:26
Hello -

From work I cannot access my private e-mail account. I was looking for a
solution that would forward my mail spool upon a trigger message. Some
search on Google produced a solution that was discussed here
<http://www.xray.mpe.mpg.de/mailing-lists/procmail/1998-08/msg00361.html>.
It works well, but it bothers me that the spool is deleted once it is
mailed.

Here is my recipe:
---BOF---
ORGMAIL=/var/mail/hiebaum

:0 D
* ^From: .*(work(_at_)company\(_dot_)com)
* ^Subject: .*(+FWMAIL)
{
LOCKFILE=$ORGMAIL$LOCKEXT

        :0 c:
        IN.webmaster

        :0 frw
        * ? test -s $ORGMAIL
        | cat $ORGMAIL
        :0 Arc
        | formail -I "X-Forwarded: from $LOGNAME(_at_)$HOST" -es \
        $SENDMAIL -oi -t work(_at_)company(_dot_)com

        :0 Arc
        | cat > .sentspool
        :0 Ahi
        | true > $ORGMAIL # safer to empty it than to rm it

        :0 bfw
        | (formail -i "From: my(_at_)account(_dot_)com" ; \
        echo "\$ORGMAIL was empty.  There was nothing to forward." )
        :0
        ! work(_at_)company(_dot_)com
}
---EOF---


I found that that if I delete or comment the lines
:0 Ahi
| true > $ORGMAIL
out, then $ORGMAIL won't be deleted, but the newest message in $ORGMAIL is
mailed to me twice. I guess, a small price to pay, but if there is a more
elegant solution, I would want to know about it.

Any ideas? BTW, many thanks to David Tamkin for this great recipe. :)

-- 
CU, Niki
*Draft beer, not people*



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>
  • Forward Mail Spool on Demand, Nikolaus Hiebaum <=