WA9ALS - John wrote:
> Today I made a procmail entry like this:
> 
> :0 H
> * ^X-Spam-Status: Yes
> $HOME/mail/caughtspam

Fine.  But H is the default and does not need to be specified.  But it
won't hurt if you do anyway.

If caughtspam is a single file then you need to make that :0: with a
trailing : to get a lock file.  That is very important or you can have
mailbox corruption as several processes all write to the file at the
same time.  If caughtspam is not a file then you need to call it
either caughtspam/ or caughtspam/. depending upon if you want Maildir/
style folders or MH style folders.

> However, the files are named msg.dk and msg.ek.  Being a Linux newbie, I'm
> not familiar with those filenames.  Looking at the files with vim shows that
> they are indeed the spam emails.

You have mistakenly made a directory called caughtspam and procmail is
falling back to a safe mode for putting files there.  That is probably
not what you want.  But the messages were saved.  None were lost.

Do you want a Berkeley style mbox with all messages in one file?  That
is the traditional folder format.  In which case you need to remove or
rename the directory and let procmail create it as a file.

  mv caughtspam caughtspam.save
  touch caughtspam

  :0:
  $HOME/mail/caughtspam

Do you want a MH style mail directory?  This keeps messages one
message per file but still needs locking.  That means a trailing : on
the rule.

  mv caughtspam caughtspam.save
  mkdir caughtspam

  :0:
  $HOME/mail/caughtspam/.

Do you want a Maildir/ style mail directory?  This keeps messages one
message per file but does not need locking.  So no trailing : means no
lockfile.  Maildir format is the newest format.  I use it.  But some
mail clients don't have code for it yet.

  mv caughtspam caughtspam.save
  mkdir caughtspam caughtspam/tmp caughtspam/new caughtspam/cur

  :0
  $HOME/mail/caughtspam/

> Can I run SA learn on that directory as is?

If your messages are one message per file (either MH or Maildir/
format) then this will send them one at a time to sa-learn.  [I prefer
find for these things because even on a HUGE number of files in a
directory this works.  But if you have a small directory then of
course 'for f in *;do sa-learn --single --spam < $f;done' works too.
But when it gets large that will overflow ARGS_MAX whereas find and
xargs will always work.

  find caughtspam -type f -print0 | xargs -r0l sa-learn --single --spam

If your messages are in one Berkelely mbox format file then use
formail to send one message at a time to sa-learn.

  formail -s sa-learn --single --spam < caughtspam

Don't forget to do the --ham learning from your normal mailbox too.
You want similar numbers of both if possible.

Bob

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to