procmail
[Top] [All Lists]

Re: need help with procmail

1999-02-25 15:24:50
At 15:13 1999-02-25 -0500, smalltown boy wrote:

I also created the file .procmailrc to say the following, with the
person's email address put in:

:0
* ^example(_at_)email(_dot_)address(_dot_)com
! example(_at_)email(_dot_)address(_dot_)com

Whoa Nellie!

Besides being syntactically incorrect, if it were, this is a mail loop
waiting to happen.

First, this rule is looking for the email address to appear at the
BEGINNING of a line - you're forgetting to look for a heade.  Likely,
you're looking for a message FROM someone:

:0
* ^From:(_dot_)*address(_at_)host(_dot_)domain(_dot_)tld
! address(_at_)host(_dot_)domain(_dot_)tld

This should MATCH, but you still run a nasty risk of a loop (what if the
guy at the other end has a similar rule, but which catches the messages
being forwarded by you?).  Enter X-Loop - a mechanism for determining if
you've seen this message before - before forwarding, you want to make sure
the header isn't present, and you also want to add it to the message you
send out:

:0
* ^From:(_dot_)*address(_at_)host(_dot_)domain(_dot_)tld
* !^X-Loop: bonehead
* !^FROM_DAEMON
| formail -A "X-Loop: bonehead" | \
        $SENDMAIL address(_at_)host(_dot_)domain(_dot_)tld

:0
* ^From:(_dot_)*address(_at_)host(_dot_)domain(_dot_)tld
/dev/nul


(be sure that $SENDMAIL is properly defined to your sendmail app path)

You should normally replace 'bonehead' (in both locations) with something
which is sufficiently unique to identify that it is YOUR looping component
-- but as this is really just a bouncing thing, it isn't truly necessary
(to make it unique -- X-loop *IS* necessary).

The second rule takes messages which got through the first (because they
were looped), and tosses them into the trash.  Be VERY careful with trash
rules - if you good on the syntax (an errant ! preceeding the match for
instance), you could end up trashing everythig you get.

But it doesn't work. I've tried all I can on my own, and I was hoping that
someone here could help me. Thanks.

If Procmail isn't the LDA, you need to INVOKE procmail from your .forward
file.  See the FAQ on this one, I'm quite sure it is in there.

        Check Jari Alto's tips (with links to FAQ):
        <http://mirror.ncsa.uiuc.edu/procmail/ssjaaa/pm-tips.html>

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

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