Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

procmail reciepes

13 views
Skip to first unread message

ruben safir

unread,
Oct 5, 2017, 1:12:33 AM10/5/17
to


Does this seem to make sense? I can't understand the procmail docs and
the use of the term execute within the man page

:0:
*^From.*artixlinux.org
artix

:0 E:
*^From.*perl.apache.org
mod_perl

:0 E:
*^From.*-ruben
/dev/null

Ben Bacarisse

unread,
Oct 5, 2017, 10:39:57 AM10/5/17
to
They are well-formed and look reasonable except for the fact that the
patterns probably match more than you think. Do you want to throw away
from b...@example-ruben.co.uk for example?

Here's a tip: put VERBOSE=y in the file and call procmail from the
command line. I'd have the RC file somewhere where it can't be found by
the real procmail (I am always editing it when mail is about to
arrive). Then you can type a "fake" message and see what happens:

$ procmail ./pm.rc
From: b...@example-ruben.com
procmail: [26321] Thu Oct 5 15:34:10 2017
procmail: No match on "^From.*artixlinux.org"
procmail: No match on "^From.*perl.apache.org"
procmail: Match on "^From.*-ruben"
procmail: Assigning "LASTFOLDER=/dev/null"
procmail: Opening "/dev/null"
Folder: /dev/null

I typed the "From: b...@example-ruben.com" line and the ^D to close the input.

BTW, this is not really a shell question but I'm not really sure where
it belongs.

--
Ben.

Ian Zimmerman

unread,
Oct 5, 2017, 2:36:17 PM10/5/17
to
On 2017-10-05 01:12, ruben safir wrote:

> :0:
> *^From.*artixlinux.org
> artix
>
> :0 E:
> *^From.*perl.apache.org
> mod_perl
>
> :0 E:
> *^From.*-ruben
> /dev/null

> Does this seem to make sense?

A bit of sense, yes, but:

1. You probably want to start the patterns with "^From:" rather than
"^From", otherwise it will match any header name that starts with that
word.

2. The patterns are regular expressions, so you need to escape the dots
if you mean to match them literally, as I'm guessing you do.

3. It is probably a bad idea to rely on the current directory in the
mailbox names. Use absolute names, e.g.

:0 E:
*^From:.*perl[.]apache[.]org
/home/ruben/Mail/mod_perl

> I can't understand the procmail docs

In that case, I cannot recommend using it. procmail is quirky, old and
unmaintained; there may well be security bugs in it, and unfortunately
it was traditionally installed setuid. In fact, this is the first thing
you should check and fix, if necessary, in case you want to continue
exploring it.

I use procmail myself but I try to make its job as narrow as possible,
and I'm looking for alternatives.

--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
Do obvious transformation on domain to reply privately _only_ on Usenet.

Popping mad

unread,
Oct 5, 2017, 5:07:10 PM10/5/17
to
On Thu, 05 Oct 2017 15:39:53 +0100, Ben Bacarisse wrote:

> ruben safir <ru...@mrbrklyn.com> writes:
>
>> Does this seem to make sense? I can't understand the procmail docs and
>> the use of the term execute within the man page
>>
>> :0:
>> *^From.*artixlinux.org
>> artix
>>
>> :0 E:
>> *^From.*perl.apache.org
>> mod_perl
>>
>> :0 E:
>> *^From.*-ruben
>> /dev/null
>
> They are well-formed and look reasonable except for the fact that the
> patterns probably match more than you think. Do you want to throw away
> from b...@example-ruben.co.uk for example?
>

yeah - I do actually because that is a pattern from a lot of spammers. I'll take my chances.


> Here's a tip: put VERBOSE=y in the file and call procmail from the
> command line. I'd have the RC file somewhere where it can't be found by
> the real procmail (I am always editing it when mail is about to
> arrive). Then you can type a "fake" message and see what happens:
>
> $ procmail ./pm.rc
> From: b...@example-ruben.com
> procmail: [26321] Thu Oct 5 15:34:10 2017
> procmail: No match on "^From.*artixlinux.org"
> procmail: No match on "^From.*perl.apache.org"
> procmail: Match on "^From.*-ruben"
> procmail: Assigning "LASTFOLDER=/dev/null"
> procmail: Opening "/dev/null"
> Folder: /dev/null
>
> I typed the "From: b...@example-ruben.com" line and the ^D to close the input.
>
> BTW, this is not really a shell question but I'm not really sure where
> it belongs.


That was my thought. This is the best fit. Thanks for the tips

Popping mad

unread,
Oct 5, 2017, 5:08:18 PM10/5/17
to
On Thu, 05 Oct 2017 11:36:02 -0700, Ian Zimmerman wrote:

> On 2017-10-05 01:12, ruben safir wrote:
>
>> :0:
>> *^From.*artixlinux.org
>> artix
>>
>> :0 E:
>> *^From.*perl.apache.org
>> mod_perl
>>
>> :0 E:
>> *^From.*-ruben
>> /dev/null
>
>> Does this seem to make sense?
>
> A bit of sense, yes, but:
>
> 1. You probably want to start the patterns with "^From:" rather than
> "^From", otherwise it will match any header name that starts with that
> word.
>


right
0 new messages