procmail
[Top] [All Lists]

Re: match the word in username and domain

1997-03-20 02:35:08
On Thu, 20 Mar 1997 15:08:53 -0700,
hsb957170(_at_)rccvax(_dot_)ait(_dot_)ac(_dot_)th (RAJESH SHARMA) wrote:
* !^From +YOUR_USERNAME

Change "YOUR_USERNAME" to your own username (apparently either
"rajesh" or "hsb957170"?)
  I would actually not bother with this at all since I'm not very
likely to send myself mail with a forged From: line but to each
her/his own :-)

* !^Subject:.*Re:

This will refuse "emacs dumps core: help me!" but again this is
probably mostly an academic point. You might want to change this to
"!^Subject:[    ]*Re:" (that's a space and a tab between the brackets)
or at least "!^Subject:.*\<Re:" which will only match when "re"
constitutes a word in itself. 

Now I am trying to write a recipe for refusing emails from a user "Papan John
Kumar" with email address "john(_at_)mail(_dot_)abcd(_dot_)edu(_dot_)au"
<...>
* ^From(_dot_)*papan(_dot_)*john(_at_)(_dot_)*abcd\(_dot_)au

Preferrably you should only match on the actual email address (and
you're lacking the ".edu" subdomain here, I think) -- you are relying
on him to send you messages with a from header something like

    From: Papan John Kumar <john(_at_)mail(_dot_)abcd(_dot_)edu(_dot_)au>

but there are other valid formats, which he can use to bypass your
filter, or he could just change to a mail client which uses a
different format. (Valid variations include 
"john(_at_)mail(_dot_)abcd(_dot_)edu(_dot_)au"
and "john(_at_)mail(_dot_)abcd(_dot_)edu(_dot_)au (Papan John Kumar)". The 
latter is the
format you are using yourself.)
  You can get a "canonical" address by running the message through
formail -r[t]zxTo: -- this is something you see often in Procmail
recipes: 

    FROM=`formail -rtzxTo:`

    :0
    * FROM ?? john(_at_)(_dot_)*\(_dot_)abcd(_dot_)\(_dot_)edu\(_dot_)au
    | ...

But in this case what you have is probably good enough if you just
remove the reference to his "real" name and add the .edu, since it
will most likely match already on his From_ line. 

| (formail -r ; cat $HOME/refused.txt) | $SENDMAIL -oi -t
              ^^
-rt might be preferrable here, depending on what the messages you
receive look like. The manual speaks of "trusting" the user to send
you a correctly formatted message but I believe the implications are
purely technical in the end. 

These are mostly minor points, I hope I haven't missed anything major.

/* era */

On Mon, 09 Sep 96 10:32:25 +0200, 
bortzmeyer(_at_)josephine(_dot_)sis(_dot_)pasteur(_dot_)fr
(Stephane Bortzmeyer) wrote on Procmail-L:
On Friday 6 September 96, at 22 h 52, the keyboard of
dattier(_at_)wwa(_dot_)com (David W. Tamkin) wrote:
Alan Stebbens posted the formail -r[t] rank bar graph from
version 3.11pre4. It might be easier to follow as a top-to-bottom
listing (and again, Tom Zeltwanger appears to be using one of the
older versions where From_ was mistakenly overpromoted). These
are the rankings in version 3.11pre4:
Always use 'formail -rt' and never 'formail -r'. Because such
precedence (Sender over From) is an important violation of RFC 822.
There is one canonical order, described in the RFC and nothing else
should be used, like fuzzy ranking or, worse, reordering. This is a
serious problem with formail.

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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