Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Sep 17, 2009 6:29 pm 
Offline
Senior Newbie

Joined: Wed Jan 07, 2009 5:25 am
Posts: 10
Website: http://chrisboshuizen.com
Hi all,

I am trying to train the SpamAssassin Bayes filter from the shell, but instead of deleting the spam messages I want to move them to an archive. Is there an easy way to do the move via a shell script? What I have doesn't work, as my mail clients still think the mail is in the original folder, and then the messages duplicate.

Here is what i have so far (based on http://www.trumphurst.com/weblog/tagspam.html):

Code:
# Tag spam in the spam maildir, and notspam in the notspam maildir
# MOVE the tagged mail
#
# The virtual domain where the spam and notspam mailboxes live
MAILHOME=/var/spool/mail/virtual/USERNAME

# The spam and notspam mailboxes
SPAMDIR=.Junk
SPAMARC=.Junk_Archive
HAMDIR=.Message_Archive

# Run sa-learn on all the mail, whether it has been seen by a mail reader or not
sa-learn --spam $MAILHOME/$SPAMDIR/new
sa-learn --spam $MAILHOME/$SPAMDIR/cur

# Move tagged mail, so it isn't used again
mv $MAILHOME/$SPAMDIR/new/* $MAILHOME/$SPAMARC/new/
mv $MAILHOME/$SPAMDIR/cur/* $MAILHOME/$SPAMARC/cur/
#mv $MAILHOME/$SPAMDIR/courierimapkeywords/.*
#     $MAILHOME/$SPAMARC/courierimapkeywords/
rm $MAILHOME/$SPAMDIR/courierimapkeywords/.*


Anyway, it does seem to move the messages, but clearly isn't doing so in a way valid under IMAP, as as soon as I view the Junk folder in my client the messages reappear, as I mentioned.

Any suggestions on how to properly do this?

Thanks!

Chris


Top
   
 Post subject:
PostPosted: Mon Sep 21, 2009 1:20 am 
Offline
Senior Newbie

Joined: Wed Jan 07, 2009 5:25 am
Posts: 10
Website: http://chrisboshuizen.com
Did I post this in the wrong forum?


Top
   
 Post subject:
PostPosted: Mon Sep 21, 2009 3:44 am 
Offline
Senior Member

Joined: Fri Sep 12, 2008 3:17 am
Posts: 166
Website: http://independentchaos.com
Try ServerFault, I guess no one here knows the answer.

_________________
If it ain't broke, you didn't tweak it enough. If it is broke, use more duct tape.
http://independentchaos.com


Top
   
 Post subject: Dovecot
PostPosted: Sun Oct 04, 2009 3:52 am 
Offline
Senior Newbie

Joined: Thu Apr 21, 2005 9:32 am
Posts: 11
Website: http://www.tangloid.net/
I use something similar and it works for me. Well, my setup is based on Dovecot/IMAP.


Top
   
 Post subject:
PostPosted: Mon Oct 05, 2009 12:48 pm 
Offline
Senior Newbie

Joined: Wed Jan 07, 2009 5:25 am
Posts: 10
Website: http://chrisboshuizen.com
Thanks, are you able to post what you use?


Top
   
 Post subject:
PostPosted: Mon Oct 05, 2009 2:54 pm 
Offline
Senior Newbie

Joined: Thu Apr 21, 2005 9:32 am
Posts: 11
Website: http://www.tangloid.net/
Sorry, I do not use anything special, just mv like you. The difference is that you (according to your paste above) use Courier as IMAP server, while I use Dovecot as IMAP server. Thus the solution should be 'switch to Dovecot'. It does not sound reasonable to switch just because of that. Still, Dovecot is popular and secure, with many features. I myself had used Courier years ago, and switched to the Dovecot, do not regret it.


Top
   
 Post subject:
PostPosted: Mon Oct 05, 2009 3:18 pm 
Offline
Senior Newbie

Joined: Wed Jan 07, 2009 5:25 am
Posts: 10
Website: http://chrisboshuizen.com
OK, thanks I'll have another shot at it.


Top
   
 Post subject:
PostPosted: Mon Oct 05, 2009 9:06 pm 
Offline
Senior Member

Joined: Sun Aug 31, 2008 4:29 pm
Posts: 177
Have a look at 'cleanup-maildir', a python script.

The script: http://svn.houseofnate.net/unix-tools/t ... up-maildir

Some discussion: http://www.ducea.com/2006/11/25/cleanup ... old-mails/


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group