On Tue, 2010-09-14 at 09:51 +0200, Giles Coochey wrote: > On Tue, September 14, 2010 09:41, Hans-Werner Friedemann wrote: > > i want to achieve a kind of auto-mass-import of eml-Files with sa-learn. > > The SPAM and HAM mails will be saved in different folders.
EML sounds like messages created by an MUA, as in "safe to disk". This usually alters the message in one way or another. Directly operating on an IMAP backend storage is preferable. If this is Outlook generating the EML, SA can not read it directly without conversion. And IIRC the message has been quite severely damaged anyway. > I don't know about the .eml mail format... so you may need to do some > pre-processing on that... but I have the following simple script in my > cron: Getting slightly off-topic here and running low on caffeine, but... > sa-learn --spam "/home/user/.maildir/.Junk\ E-mail/new/" --showdots > No need to learn new/. Mail in there is \Recent and has not been seen by an MUA, let alone read by a human. A folder with manually moved spam will never have a message in there anyway. > sa-learn --spam "/home/user/.maildir/.Junk\ E-mail/cur/" --showdots > > /dev/null 2>&1 > rm -f /home/user/.maildir/.Junk\ E-mail/cur/* > /dev/null 2>&1 The expanded * can exceed your shell limit, if there's a lot of spam. Moreover, there's a race condition missing to learn spam that has been moved by the user, after sa-learn started. To fix this, rotate the cur/ directory with an empty one, learn the old rotated-out one, and then rm the just learned dir itself. -- char *t="\10pse\0r\0dtu...@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4"; main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1: (c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}