On Sat, Feb 17, 2001 at 07:38:08PM -0600, Gary ([EMAIL PROTECTED]) wrote:
> On Sat, Feb 17, 2001 at 05:05:22PM -0500 or thereabouts, Joe Philipps wrote:
> > On Sat, Feb 17, 2001 at 10:56:03AM -0600, Gary wrote:
> > >On Fri, Feb 16, 2001 at 11:23:57PM -0500 or thereabouts, Bruce A. Petro wrote:
> 
[snip original recipe, which appears below]
> 
> > >In Procmail, these are called recipes.  Try this, which will take care of
> > >*about.com either as TO or Cc.
> > >
> > >:O: 
> > >* (^(To|Cc):*@about.com*)
> > >about.com
> 
> Of course, it would probably work I am sure.  That is the beauty of regex
> as there are several ways to write it and accomplish the same
> thing. 

No, it doesn't. That matches "To" or "Cc" at the beginning of a line,
followed by zero or more colons, followed by an at sign, followed by
"about", followed by a single character, followed by "co" followed by
zero or more "m"s.

Or, it would if you had written the first line of the recipe
correctly; you have "O" (letter) where you want "0" (zero), which
would produce an error and probably cause procmail to skip over the
recipe (but I haven't tested that). 

The canonical way to write that recipe would be

:0:
* ^TO_.*@about\.com
about.com

The "TO_" macro is one of the more useful things in procmail, and is
documented in procmailrc along with a few other macros. It represents

(^((Original-)?(Resent-)?(To|Cc|Bcc)|(X-Envelope|Apparently(-Resent)?)-To):(.*[^-a-zA-Z0-9_.])?)

The problem with the original recipe,

> > >> :0:
> > >> * ^[EMAIL PROTECTED]
> > >> about.com

was that it wasn't accounting for what came before the @ sign. (It was
also accepting any character between the "T" and "C", but that's a
pretty common procmail error and wouldn't actually stop it from
*working*, it just might generate a rare false positive.)

> Of course, Bruce's real problem was having ABOUT.COM in caps to
> begin with. as you know, UNIX/Linux is case sensitive.

Uh, in filesystems, yes. Procmail isn't case-sensitive unless you
explicitly tell it to be on a per-recipe basis with the 'D' flag.

ObFMReading: procmail(1), procmailrc(5), procmailex(5), the Internet
Mail Filtering FAQ. The procmailex(5) manual page gives an excellent
idea of the power and flexibility of procmail.

My favorite procmail trick is the anti-duplicates recipe in
procmailex(5), although the recipes to mime-ify non-pgpmime messages
are up there on the list too.

  -Rich

-- 
------------------------------ Rich Lafferty ---------------------------
 Sysadmin/Programmer, Instructional and Information Technology Services
   Concordia University, Montreal, QC                 (514) 848-7625
------------------------- [EMAIL PROTECTED] ----------------------

Reply via email to