Been using this for a short while and I've been running into the same problem
all the time with regards to using imap folders with sa-learn.
If I use the following command line
sa-learn --spam mail/spam-mailbox
I get the response
Learned from 1 message(s) (1 message(s) examined).
which tells me it read it only as one message due to the imap folder entry at
the start of the folder. sa-learn it appears doesn't deal with the imap header
that is in every imap folder.
Trying the following
icat mail/spam-mailbox | sa-learn --spam --mbox
I basically get the below.
Use of uninitialized value in concatenation (.) or string
at /usr/share/perl5/Mail/SpamAssassin/ArchiveIterator.pm line 334.
unable to open : No such file or directory
Use of uninitialized value in pattern match (m//)
at /usr/share/perl5/Mail/SpamAssassin/ArchiveIterator.pm line 324.
Use of uninitialized value in pattern match (m//)
at /usr/share/perl5/Mail/SpamAssassin/ArchiveIterator.pm line 324.
Use of uninitialized value in string
at /usr/share/perl5/Mail/SpamAssassin/ArchiveIterator.pm line 331.
As far as I can tell, due to using imap folders, the only way I can get sa-
learn to accept the mail and read it correctly is:
icat ~/mail/spam-mailbox > ~/spammail; sa-learn --spam --mbox ~/spammail; rm
~/spammail
This seems a little cumbersome but does work fine and as required sees the
folder contains about 270 mails.
The following also works:
icat ~/mail/spam-mailbox > ~/spammail; sa-learn --spam --mbox < ~/spammail; rm
~/spammail
Am I missing something simple that would allow me to accomplish this in one
command, or is it basically that it just doesn't support this yet.
I have an alias set up to read through both a spam and a ham folder and rebuild
the database afterwards.
alias auto-sa-learn='icat ~/mail/spam-mailbox > ~/spam-mailbox; sa-learn --
spam --no-rebuild --mbox < ~/spam-mailbox; icat ~/mail/spam-ham-mailbox >
~/spam-ham-mailbox; sa-learn --ham --no-rebuild --mbox < ~/spam-ham-mailbox; rm
~/spam*mailbox; sa-learn --rebuild'
But even though it works, I'm not particularly happy that its the best way to
this.
--
Darragh
"Nothing's foolproof to a sufficently talented fool"
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!