icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » Email » new spamassassin script

Email General questions, webmail, mailing lists.

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old June 9th, 2007, 6:03 PM   #1 (permalink)
Surpass Fan
Comfy Contributor
 
jdcopelin's Avatar
 
Joined in Feb 2004
Lives in Norfolk, England
Hosted on Pass32
167 posts
Gave thanks: 23
Thanked 19 times
new spamassassin script

Dear All,

Some of you who run your own spamassassin training scripts using cron might be interested in the latest update to the one I posted in one of the other threads on the subject. I completely re-wrote it to give better output and make configuration easier. I'm not a regular poster on these forums, but the forums have been a useful resource for me. So, this is a sort of thank-you to everyone here

I suppose I have to say that it is run at your own risk, although I use this same file (with a couple of alterations for the names of folders) on live servers with numerous email accounts without any problems. If you run the script on your account, make sure you have backups, or use new spam/ham folders just for testing (use an IMAP client to copy from another email folder). There is a section clearly marked and documented at the top of the file to change the names of the folders the script looks for.

As a summary:
1. It works with MAILDIR only
2. Finds all spam and ham folders of the same name in ALL email accounts for the cpanel account it is run on.
3. users have to move uncaught spam to a learnspam folder.
4. users should move false positives to a ham folder (and any legitimate messages they receive to balance the bayes database).
5. messages marked as read in the spam folder get learned from each time the script is run.
6. spam messages older than 7 days get automatically learnt.
7. the /new maildir folder does not get processed by this script, so nothing is done to messages
that the user hasn't seen on their screen.
8. ham and spam messages are moved to (configurable) folders after the learning process.
9. it doesn't run sa-learn if there are no messages in the folders

NOTE: If you have a dedicated server, DO NOT RUN AS ROOT unless you specifically know the consequences. You would only run as root if you use machine wide bayes databases etc. By default spamassassin runs per user (site).

It was rather long to post as code/text, so I have attached it as a file. You will have to rename it once you FTP it to your account (and enable execute permissions on it). It is meant to be run via cron however often you feel it needs to run.

Please let me know either on here or by email if you have problems or questions. If I can make any improvements I would be glad to hear your comments!

Regards
Jonathan
Attached Files
File Type: txt learnspam.txt (4.0 KB, 82 views)
__________________
Server: Pass32 and dedicated server
jdcopelin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks jdcopelin for this great post!
Edwin (July 30th, 2007)
Old June 9th, 2007, 7:25 PM   #2 (permalink)
minor deity
Super #1
 
Bigjohn's Avatar
 
Joined in Apr 2004
Lives in Georgia
Hosted on XEON
7,395 posts
Gave thanks: 28
Thanked 94 times
Jonathan -

This may ultimately end up being a godsend! Thanks.

I'll have a look at it. One of the servers I have some clients on is running 'maildir'...
__________________
Proud to be a Surmunity Mod!
XEON PASS60 PASS61
Make a fundamental difference!
My Sites:
Curious about Brewing Beer? Join the community!
>>>>> Some Change is GOOD! Keep your paycheck! Support the Fair Tax
Get into an Art museum
Victorian London
It's your brain -ON WEB - mybrainhost.com (under development)
What SHOULD Government do? Much Less than it Does!
Bigjohn is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 19th, 2007, 6:23 PM   #3 (permalink)
Surpass Fan
Seasoned Poster
 
sandersans's Avatar
 
Joined in Jun 2003
Lives in SoCal
Hosted on Vega
86 posts
Gave thanks: 1
Thanked 0 times
Will this work if you have mail forwarders? Instead of having additional mailboxes for all my email addys I just have forwarders set to send them to my main account. This prevents duplicate emails (one in the original mailbox and one in the main account the email was forwarded to).
__________________
funny, witty, thought provoking signature
sandersans is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 19th, 2007, 7:24 PM   #4 (permalink)
Surpassing Dutch
Super #1
 
Edwin's Avatar
 
Joined in Sep 2004
Hosted on SH98
2,556 posts
Gave thanks: 189
Thanked 45 times
I will try it, if the server I'm on can run it
__________________
sh98
Edwin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 20th, 2007, 4:05 PM   #5 (permalink)
Surpass Fan
Comfy Contributor
 
jdcopelin's Avatar
 
Joined in Feb 2004
Lives in Norfolk, England
Hosted on Pass32
167 posts
Gave thanks: 23
Thanked 19 times
Quote:
Originally Posted by sandersans View Post
Will this work if you have mail forwarders? Instead of having additional mailboxes for all my email addys I just have forwarders set to send them to my main account. This prevents duplicate emails (one in the original mailbox and one in the main account the email was forwarded to).
Hello,

Yes, the forwarded messages still end up being stored in the same way, so the script will work. I have webmaster and other aliases forwarded to another email address on the account and it works fine. The script lists all the mail folders as it is processing them so you can see where it has "been".

Hope you find my script useful.
Cheers
Jonathan
__________________
Server: Pass32 and dedicated server
jdcopelin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 20th, 2007, 4:21 PM   #6 (permalink)
Surpass Fan
Comfy Contributor
 
jdcopelin's Avatar
 
Joined in Feb 2004
Lives in Norfolk, England
Hosted on Pass32
167 posts
Gave thanks: 23
Thanked 19 times
Quote:
Originally Posted by Edwin View Post
I will try it, if the server I'm on can run it
Hello Edwin,

If your server uses maildir format and not mbox then I see know reason why it shouldn't work. There are two ways to find out which one your server has:
1) go to "server status" in one of your cpanel accounts. If exim shows as "(exim-4.66-0_cpanel_maildir)" then you have maildir.
2) if your server uses maildir format, the /home/username/mail folder for your account will have new/ cur/ and tmp/ directories.

As long as the paths are set correctly in the script, then you shouldn't have any problems running it. If you do decide to run it, make a backup of the home directory just in case. Depending on how many people ask questions, I might add some info on how to change it to test just a single email account.

Let me know how you get on with the script. There is an updated version in the pipeline already, so the more feedback I get the better it will become!

Regards
Jonathan
__________________
Server: Pass32 and dedicated server
jdcopelin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 20th, 2007, 5:05 PM   #7 (permalink)
Surpassing Dutch
Super #1
 
Edwin's Avatar
 
Joined in Sep 2004
Hosted on SH98
2,556 posts
Gave thanks: 189
Thanked 45 times
I guess this only works on dedicated machines, and not on shared.
__________________
sh98
Edwin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 20th, 2007, 5:28 PM   #8 (permalink)
Surpass Fan
Comfy Contributor
 
jdcopelin's Avatar
 
Joined in Feb 2004
Lives in Norfolk, England
Hosted on Pass32
167 posts
Gave thanks: 23
Thanked 19 times
Quote:
Originally Posted by Edwin View Post
I guess this only works on dedicated machines, and not on shared.
Hmm not sure what gave you that idea . Not all shared servers use maildir yet though. The script runs on a single cpanel account. I run the script on my reseller account (pass32) without any problems and my dedicated is a similar set-up to pass32.

Cheers
Jonathan
__________________
Server: Pass32 and dedicated server
jdcopelin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 20th, 2007, 5:41 PM   #9 (permalink)
Surpassing Dutch
Super #1
 
Edwin's Avatar
 
Joined in Sep 2004
Hosted on SH98
2,556 posts
Gave thanks: 189
Thanked 45 times
I couldn't find any of those things you said in your earlier post. So I thought it must be dedicated. But maybe I just didn't check it good enough (a few beers do that) or the server is not yet ready for it.

Edit: It *WAS* the beers . this is what I found:
Quote:
exim (exim-4.63-1_cpanel_smtpctl_av_rewrite_mm2_mmmtrap_exiscan_md 5pass)
__________________
sh98
Edwin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On