On Mon, Sep 08, 2003 at 05:06:00PM -0500, Ben Bargabus wrote:
> I'm not following the loop aspect (I'm brand new to procmail), could
> you explain what's happening here a bit?

Let's say you mistakenly forward email from your forwarding destination.
You want to have something in the header of the email so that when
procmail sees it again, it can recognize that it's already been
forwarded.  This may not happen often, but when it does, you'll get a
nasty mail loop going.

Let's say there are three accounts on three servers: THISHOST, THATHOST,
and OTHERHOST.  You have the ability to forward from any of these
accounts, and you can quickly loose track of where the email has been.

  1. Receive email at THISHOST
  1.2. Process in procmail.
  1.3. Forward processed email to THATHOST

  2. Receive email at OTHERHOST.
  2.1. Cleverly process email and forward to THISHOST (Step 1)
  2.2. Cleverly process email and forward to THATHOST (Step 3)

  3. Receive email at THATHOST
  ...(etc)...

However clever you may think you are, there is a pretty good chance that
you'll forget about your forwarding circus in six months.  You make
small clever change to one of the procmail scripts and WHAM!  You get
hit by a forwarding loop!

So, in the interest of Good Procmail Recipes, as opposed to Clever and
Scary Procmail Recipes, it's wise to add the X-Loop header or some sort
of identification before forwarding email.

One nice thing about formail is that it preserves "X-Loop:" headers in
autoreplies, and this illustrates how important the "X-Loop:" header has
become in UNIX email management. 

A thought just occurred to me.  There may be cases where you do not want
to clobber existing X-Loop headers.  For example, you're autoreplying to
an email which may be an autoreply in and of itself.  When the recipient
sees his/her own X-Loop, it stops processing.  For situations like this,
use "formail -A" instead of "-I".

  :0 fhw
  * ! ^X-Loop: me at here
  | formail -A "X-Loop: me at here"

    # Only forward if x-loop added
    :0 a
    ! me at there

      :0 e
      failed-forward


-- 
Chad Walstrom <chewie at wookimus.net>           http://www.wookimus.net/
           assert(expired(knowledge)); /* core dump */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20030908/ab698b5c/attachment.pgp