procmail
[Top] [All Lists]

Re: forward-loop

1999-05-04 00:26:45
On Tue, 4 May 1999 00:20:34 +0200 (CEST), Johannes Philipp Krone
<jpk(_at_)kiste(_dot_)itc(_dot_)or(_dot_)at> wrote:
:0c
* !^From(_dot_)*internetz*(_at_)vibe(_dot_)at
!jpk(_at_)maxonline(_dot_)at 
(mails that don't come from *internetz*(_at_)vibe(_dot_)at should be 
forwarded to the
given address and saved to the default mailbox file)

Minor nit: *internetz* is an invalid regular expression. Your
condition says you want to execute the action on anything not matching

  ^        Beginning of line,                                    followed by
  From     the literal string "From" (case insignificant),       followed by
  .*       nothing, or anything (zero or more of any character), followed by
  internet the literal string "internet" (case insignificant),   followed by
  z*       zero or more occurrences of the character "z",        followed by
  @vibe    the literal string "vibe@" (case insignificant),      followed by
  .        any character,                                        followed by
  at       the literal string "at" (case insignificant)

Note in particular the meaning of . (any character) and * (zero or
more repetitions of the previous regular expression).

The host of the destination host 'forgot' its users and therefor
the mail got bounced back to me (jpk(_at_)kiste(_dot_)itc(_dot_)or(_dot_)at) 
- this
mailerdaemon-mail was forwarded to jpk(_at_)maxonline(_dot_)at, got bounced
and forwarded again ... and so on.

The procmailex man page has a smallish discussion of this topic.
Basically, you insert a special header saying "this has already been
forwarded" (the customary header to use is X-Loop: with a string you
can be reasonably sure is unique, such as your own e-mail address) and
don't forward anything already containing this header. (It is also
fairly usual to not forward stuff from MAILER_DAEMON, i.e. bounces
etc., or forward it under constrained conditions only.)

    :0c
    * ! ^From:(.*\<)?internetz[^<>      @]*(_at_)vibe\(_dot_)at
    * ! ^FROM_DAEMON
    * ! ^X-Loop: jpk(_at_)maxonline\(_dot_)at
    | formail -A "X-Loop: jpk(_at_)maxonline(_dot_)at" \
      | $SENDMAIL $SENDMAILFLAGS jpk(_at_)maxonline(_dot_)at

I am assuming you were meaning to forward anything from the address
internetz, possibly followed by a plussed string or something. (The
^From condition line is only a rough approximation of this. The stuff
between > and @ is a space and a tab.)

If you want bounces forwarded generally, but not bounces with the
X-Loop header in them, you'll probably have to look for the X-Loop:
header in the body of the bounce (or maybe not; examine one of the
bounces to see what you can match on).

Hope this helps,

/* era */

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

<Prev in Thread] Current Thread [Next in Thread>
  • forward-loop, Johannes Philipp Krone
    • Re: forward-loop, era eriksson <=