OT: procmailrc question

Cameron Simpson cs at zip.com.au
Wed Jan 8 04:38:50 UTC 2014


On 07Jan2014 22:04, Ranjan Maitra <maitra.mbox.ignored at inbox.com> wrote:
> I am new to making my own procmail recipes and am a bit stumped with
> this one.
> 
> I use sylfilter as my spam-filtering tool: this tool is available at
> http://sylpheed.sraoss.jp/sylfilter/
[...]
> Being perhaps foolhardy, I have been trying to get syfilter to work
> with procmail using my .procmailrc. I was trying to mimic the example
> here:
> http://www.math.tohoku.ac.jp/~kuroki/keijiban/procmailrc.txt
> 
> However, the issue is that I do not quite see how to get this to work
> because unlike bogofilter, sylfilter does not add anything to the
> header. If it returns a value 0, the mail  is classified as junk,
[...]
> (which the user does not see):
> Return values:
>   0   junk (spam)

As you say, it does not modify the email.

Instead, you want a recipe shaped like this one:

  # Get rid of duplicates
  :0 Whc: .msgid.lock
  | formail -D 16384 .msgid.cache
  :0 a
  /dev/null

This recipe discards duplicate emails, but by replacing the "formail" command
with your "sylfilter" command you can have it discard (or file) junk email.

Example (untested, needed adapting):

  # Get rid of duplicates
  :0 Wc
  | sylfilter ...
  :0 a
  /dev/null

"sylfilter" will receive a copy of the message on its standard
input.  The above recipe should file messages to /dev/null if
sylfilter returns an exit status of 0. Of course, change "/dev/null"
to the name of a folder if you plan to file junk email (for review)
instead of discarding it.

Note that the above recipe is actually two procmail filters: the
first uses sylfilter as the message filer (which is hy it has the
"c" flag; it is "filing" a copy). The filter recipe depends on the
success of the prceeding one, so if sylfilter did not consider the
message to be junk, the second filter will not file the message as
junk.

See "man 5 procmailrc" for details.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au>

In the wet the rear is more controllable and easy to use I would agree.
But the front is still where most of your power is. Learn to use the
force correctly Luke! Don't succumb to the high side!!!
        - Erik.Astrup at f501.n914.z8.rbbs-net.ORG (Erik Astrup)


More information about the users mailing list