looking for simple procmail recipe

1 view
Skip to first unread message

Jonathan Ganz

unread,
Feb 28, 2004, 12:15:16 AM2/28/04
to
I'm interested in filtering out spam with nothing (not even HTML) in
the body, variable subject and header info.

Does someone have a simple procmail snipit I can use for this?

TIA
Jonathan


Alan Connor

unread,
Feb 28, 2004, 12:58:20 AM2/28/04
to

Do you mean an empty body?

:0B
* ![a-zA-Z0-9]
/dev/null

Egrep the body for a letter or a number, and if you can't find one,
send it to /dev/null.

We on the right track?


AC

--
Pass-List -----> Block-List ----> Challenge-Response
The key to taking control of your mailbox.
http://www.uwasa.fi/~ts/info/spamfoil.html
http://tinyurl.com/3c3ag

Jonathan Ganz

unread,
Feb 28, 2004, 2:29:04 AM2/28/04
to
"Alan Connor" <zzz...@xxx.yyy> wrote in message
news:06W%b.12634$aT1....@newsread1.news.pas.earthlink.net...

Alan,

Thanks. So this recipe (just so I'm clear) invokes egrep? Sorry if that's
a stupid question.

Jonathan


Jonathan Ganz

unread,
Feb 28, 2004, 2:34:57 AM2/28/04
to
"Alan Connor" <zzz...@xxx.yyy> wrote in message
news:06W%b.12634$aT1....@newsread1.news.pas.earthlink.net...

One other question if you don't mind. Is there a way to save a copy
in a file? The recipe seems to work, but I'm paranoid at this point.

Regards,
Jonathan


Alan Connor

unread,
Feb 28, 2004, 12:15:33 PM2/28/04
to

To cover both of your posts ( and I well understand your caution...wise ).
Procmail has an internal egrep with a few features of its own. Gotta spend
some time with the excellent manpages: procmail procmailrc procmailex and
then there's the scoring one, which I don't use.

To save a backup copy of everything:

:0:
backup

:0h: to just save the headers.


At the top of your .procmailrc to catch everything. It won't get anything
that has been previously delivered, unless you put a c, for send a copy on,
in front of any recipes you have:

:0c:

Don't use a lockfile (the second :) for recipes that deliver to /dev/null.
Here's a cool webpage full of practical tips:

http://www.uwasa.fi/~ts/info/proctips.html

And a procmail links page: http://www.iki.fi/~era/procmail/links.html


And hit the procmail.org website for all sorts of info.


Have a good one,

those who know me have no need of my name

unread,
Feb 28, 2004, 9:49:18 PM2/28/04
to
in comp.mail.misc i read:

>"Alan Connor" <zzz...@xxx.yyy> wrote in message
>news:06W%b.12634$aT1....@newsread1.news.pas.earthlink.net...

>> :0B


>> * ![a-zA-Z0-9]
>> /dev/null
>>
>> Egrep the body for a letter or a number, and if you can't find one,
>> send it to /dev/null.

>Thanks. So this recipe (just so I'm clear) invokes egrep?

no. procmail uses an egrep-like syntax, which is to say extended regular
expressions.

--
a signature

s. keeling

unread,
Feb 28, 2004, 10:43:04 PM2/28/04
to
On Fri, 27 Feb 2004 23:34:57 -0800, Jonathan Ganz <nos...@noooOoooospam.com>:

> "Alan Connor" <zzz...@xxx.yyy> wrote in message
> news:06W%b.12634$aT1....@newsread1.news.pas.earthlink.net...
> > On Fri, 27 Feb 2004 21:15:16 -0800, Jonathan Ganz
> <nos...@noooOoooospam.com> wrote:
> > >
> > >
> > > I'm interested in filtering out spam with nothing (not even HTML) in
> > > the body, variable subject and header info.
> >
> > Do you mean an empty body?
> >
> > :0B
> > * ![a-zA-Z0-9]
> > /dev/null
> >
> > Egrep the body for a letter or a number, and if you can't find one,
> > send it to /dev/null.
>
> One other question if you don't mind. Is there a way to save a copy
> in a file? The recipe seems to work, but I'm paranoid at this point.

Change the /dev/null to something else and it will be stored in that
mail file. Then you can review its contents at your leisure until
you're sure it's doing exactly what you want.

Procmail supports X plus making a copy and doing something else with
the copy, but that makes no sense here.


--
Any technology distinguishable from magic is insufficiently advanced.
(*) http://www.spots.ab.ca/~keeling
- - Spammers! http://www.spots.ab.ca/~keeling/spammers.html
http://learn.to/quote http://www.netmeister.org/news/learn2quote.html

Jonathan Ganz

unread,
Feb 29, 2004, 1:08:17 AM2/29/04
to
"those who know me have no need of my name" <not-a-rea...@usa.net>
wrote in message news:m1ptby7...@usa.net...

ah...


Jonathan Ganz

unread,
Feb 29, 2004, 1:13:12 AM2/29/04
to
"Alan Connor" <zzz...@xxx.yyy> wrote in message
news:V040c.13067$aT1....@newsread1.news.pas.earthlink.net...

Alan, Thanks. Right now I have it working with just dev/null (no "c"),
so I'm not sure what you mean by not including the ":" after the c if
going to dev/null. Did you mean not include the "c" and the ":"?

Sorry for all the newbie questions! And, thanks for the links!

Jonathan


Alan Connor

unread,
Feb 29, 2004, 1:58:18 AM2/29/04
to
On Sat, 28 Feb 2004 22:13:12 -0800, Jonathan Ganz <nos...@noooOoooospam.com> wrote:

<snip>

>
> Alan, Thanks. Right now I have it working with just dev/null (no "c"),
> so I'm not sure what you mean by not including the ":" after the c if
> going to dev/null. Did you mean not include the "c" and the ":"?
>
> Sorry for all the newbie questions! And, thanks for the links!
>
> Jonathan
>

What you need to do is read the man pages, particularly procmailrc.
>

And trim your posts.


Have a good one.

AC

--
ed(1) Check out the original tutorials by Brian W.
Kernighan at the Ed Home Page http://tinyurl.com/2aa6g

B. Johannessen

unread,
Feb 29, 2004, 2:45:19 AM2/29/04
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alan Connor wrote:
> What you need to do is read the man pages, particularly procmailrc.
> And trim your posts.

To "trim you posts" means to remove the parts of the quoted text that
is not relevant to your reply. For a few examples of how wasteful it
is not to do this, check out the following:

http://groups.google.com/groups?as_umsgid=mOeUb.13263%24uM2...@newsread1.news.pas.earthlink.net
http://groups.google.com/groups?as_umsgid=RoJTb.9861%24F23...@newsread2.news.pas.earthlink.net
http://groups.google.com/groups?as_umsgid=nTfNb.8735%241e...@newsread2.news.pas.earthlink.net
http://groups.google.com/groups?as_umsgid=eC5Mb.4023%24zj...@newsread1.news.pas.earthlink.net
http://groups.google.com/groups?as_umsgid=SfZLb.1799%241e...@newsread2.news.pas.earthlink.net

As you can see, not trimming your posts wastes a lot of bandwidth
transferring irrelevant information, and it makes your posts harder
to read.


Bob

-----BEGIN PGP SIGNATURE-----
Comment: B. Johannessen <b...@db.org> - http://db.org/contact/en/

iD8DBQFAQZiPooisUyMOFlgRArfjAJ42D7193N/LS9809umW0Hab79GcrgCgqnIh
SKN0MdWVHfyA9497utRiHfk=
=XAdF
-----END PGP SIGNATURE-----

Alan Connor

unread,
Feb 29, 2004, 4:01:05 AM2/29/04
to
On Sun, 29 Feb 2004 07:45:19 +0000, B. Johannessen <b...@db.org> wrote:

(the rest deleted useen -- score "9" = jerk/asshole)

B. Johannessen

unread,
Feb 29, 2004, 5:11:53 AM2/29/04
to
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alan Connor wrote:
> On Sun, 29 Feb 2004 07:45:19 +0000, B. Johannessen <b...@db.org>
> wrote:

It seems you need some quoting lessons. Nothing I wrote was quoted
in that message...

> (the rest deleted useen -- score "9" = jerk/asshole)

This must be the Usenet equivalent of covering your ears and
going: na-na-na-na-na-na-na-na-na-na-na-na-na-na


Bob (jerk *and* asshole)

-----BEGIN PGP SIGNATURE-----
Comment: B. Johannessen <b...@db.org> - http://db.org/contact/en/

iD8DBQFAQbrpooisUyMOFlgRAlYrAKCiVvVvCGkiEdvu69oIp76F5c6smgCeNOi8
XlMwEnPpMbiSJ4mmpvCOslc=
=WdoW
-----END PGP SIGNATURE-----

spam...@aol.com

unread,
Mar 12, 2004, 10:43:06 PM3/12/04
to
On Sat, 28 Feb 2004 22:13:12 -0800, "Jonathan Ganz"
<nos...@noooOoooospam.com> wrote:
>> Don't use a lockfile (the second :) for recipes that deliver to /dev/null.

I'm not sure whether it was Jonathan or Alan or someone else who said
the above, but I'm wondering WHY you shouldn't use a lockfile for
recipes sending mail to /dev/null. I have lots of such recipes, and
almost all of them use a lock file. The recipes work, but if there's
some reason I still shouldn't use a lock file, I'd love to know.

TIA

CQueen

spam...@aol.com

unread,
Mar 12, 2004, 10:53:21 PM3/12/04
to

Never mind, I found the answer in Timo's FAQ at
http://www.uwasa.fi/~ts/info/proctips.html .

CQ

Nancy McGough

unread,
Mar 14, 2004, 6:17:28 AM3/14/04
to
On 12 Mar 2004 spam...@aol.com (spam...@aol.com) wrote:
> >the above, but I'm wondering WHY you shouldn't use a lockfile for
> >recipes sending mail to /dev/null.
>
> Never mind, I found the answer in Timo's FAQ at
> http://www.uwasa.fi/~ts/info/proctips.html .


I looked at Timo's page and so far I haven't found the reason
WHY. Can you give a direct link to the section that explains this
(or post an excerpt here) so I can link to it in my Procmail
Quick Start in this section:

<http://www.ii.com/internet/robots/procmail/qs/#delete>

At the moment I just say that it causes an extraneous-lockfile
error message, but I'd like to elaborate on that. My guess is
that it doesn't actually hurt anything to use a lockfile when
"delivering" to /dev/null, but I don't know for sure.

Thanks,
Nancy

--
Nancy McGough
Infinite Ink ~ <http://www.ii.com>
Deflexion & Reflexion ~ <http://deflexion.com>

DWT

unread,
Mar 14, 2004, 3:07:21 PM3/14/04
to
Nancy McGough <nm-reverse-...@ii.deflexion.com> wrote in
<Pine.OSX.4.59.99...@www.spam.deflexion.com>:

| At the moment I just say that it causes an extraneous-lockfile
| error message, but I'd like to elaborate on that. My guess is
| that it doesn't actually hurt anything to use a lockfile when
| "delivering" to /dev/null, but I don't know for sure.

You can't use a local lockfile when you're delivering to /dev/null unless
you explicitly name one in another location, because unless you're running
your .procmailrc as root, procmail cannot create /dev/null.lock.

So it's a waste of effort even to try.

Suppose it were possible for an unprivileged uid to create and remove
/dev/null.lock; potentially every user on the system gets some unwanted mail,
so if two users got mail at almost the same time that they didn't want, why
should the second one wait around to dump it until the first one removes
/dev/null.lock?

I can't remember where I read it -- likely not in the man pages -- that
(not only for those reasons but also because there just plain is no point
in serializing writes to /dev/null) procmail ignores a request for an
implicitly named local lockfile when the action is to deliver to /dev/null.
So that second colon is a waste that procmail just has to read past.

But the main waste is the mental misunderstanding of a user who puts a
second colon on a dump to /dev/null to get a local lockfile for it.

Since nobody invokes procmail with more than one rcfile named on the command
line any more, the most efficient way to drop mail into the bit bucket is
not to file it in /dev/null but to unset HOST. But when you write recipes
for somebody else to use, delivery to /dev/null is much easier for the
beneficiary to understand.

--
David W. Tamkin

The reply address accepts mail until midnight US Central Time on 21Mar2004.

Timo Salmi

unread,
Mar 14, 2004, 3:38:04 PM3/14/04
to
Nancy McGough <nm-reverse-...@ii.deflexion.com> wrote:
> On 12 Mar 2004 spam...@aol.com (spam...@aol.com) wrote:
> > >the above, but I'm wondering WHY you shouldn't use a lockfile for
> > >recipes sending mail to /dev/null.

> > Never mind, I found the answer in Timo's FAQ at
> > http://www.uwasa.fi/~ts/info/proctips.html .

Actually, not there, as such.

> I looked at Timo's page and so far I haven't found the reason
> WHY. Can you give a direct link to the section that explains this

AFAIK, because if procmail gets to choose the name, it forms the
name based on the target file's name. In the case if /dev/null that
makes little sense. Now don't take this as authoritative. The true
explation is somewhere on the net, but I do not recall where.

All the best, Timo

--
Prof. Timo Salmi ftp & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/> ; FIN-65101, Finland
Timo's FAQ materials at http://www.uwasa.fi/~ts/http/tsfaq.html

Nancy McGough

unread,
Mar 15, 2004, 6:04:21 AM3/15/04
to
On 14 Mar 2004 DWT wrote:
> [...]

>
> But the main waste is the mental misunderstanding of a user who puts a
> second colon on a dump to /dev/null to get a local lockfile for it.
>
> Since nobody invokes procmail with more than one rcfile named on the command
> line any more, the most efficient way to drop mail into the bit bucket is
> not to file it in /dev/null but to unset HOST. But when you write recipes
> for somebody else to use, delivery to /dev/null is much easier for the
> beneficiary to understand.

Thank you very much for that post David! I now link to it here:

<http://www.ii.com/internet/robots/procmail/qs/#delete>

Here's the relevant part:

None of these three recipes need a lock and using one will cause
procmail to complain about an "extraneous lockfile." For details
about why it doesn't make sense to lock /dev/null, see David W.
Tamkin's 2004-03-14 message Re: looking for simple procmail
recipe in comp.mail.misc.

Note that I recommend that people set HOST to something like
'adios' rather than delivering to /dev/null or simply unsetting
HOST. For details, check it out -- and as always, feedback is
welcome.

Thank you,

Reply all
Reply to author
Forward
0 new messages