Help - Search - Members - Calendar
Full Version: Delete SPAM Email with SpamAssassin
The Planet Forums > System Administration > HOWTOs
galfau
I have seen a lot of users asking how to do automatically delete spam email instead of adding [SPAM] to the subject, and everyone who reply is with an MailScanner solution. So this is my solution in how to do it with SpamAssassin and procmail.

Just go to the user home folder,

For example lets say you want to delete spam email from 'testuser' at yourdomain.com

1. Change directory to the user home folder in the domain account
CODE
cd /home/virtual/yourdomain.com/home/testuser


2. Edit or create .procmailrc (note de '.' at the begining)
CODE
nano .procmailrc


3. Insert the following lines
CODE
SPAM_FOLDER="/dev/null"
:0 :$HOME/spamassassin.lock
* X-Spam-Status: Yes
$SPAM_FOLDER


4. Save file and Exit (Ctrl + X)


The next steps are optional but i really suggest you DO them

5. In the same user home folder change directory to .spamassassin
CODE
cd .spamassassin


6. Edit the file user_prefs
CODE
nano user_prefs


7. Search for required_hits and change it to 10, this will help with false-positive emails.



This will make all emails marked as SPAM will be send to /dev/null, which will delete them.


NOTE: If someone knows how to add this as default user configuration, i mean that when you add a new user it will come with this steps included, please feel free to post it.



:: ALTERNATIVE ::

If you log in in your ensim user administration you can also modify this within the web gui.


Thanks for reading,

Feel free to comment/suggest.
galfau
Saving this post for further use, I am going to publish and script to do the steps above to all users at all domains.
joanindo
>>>NOTE: If someone knows how to add this as default user configuration, i mean that when you add a new user it will come with this steps included, please feel free to post it.

just put the file in /etc/skel/ that will do.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.