procmail
[Top] [All Lists]

Forward Mail Spool on Demand (2nd attempt)

2003-07-01 05:11:40
Hello again -

A second attempt (original post on 06/21
<http://www.xray.mpe.mpg.de/mailing-lists/procmail/2003-06/msg00262.html>)
- maybe someone gives me some input this time.

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, 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 *plus* some messages loop. I haven't yet quite
understood why only some messages loop and despite having addedd
respective "X-Loop:" headers.

Any ideas? :)

-- 
CU, Nick
*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>