Department of
Physics & Astronomy

 
Academics
Courses
Events
Research
People
Facilities

Main Page
SFSU Home
  • Computer System
    • Using SpamAssassin

Using SpamAssassin to Detect/Remove Spam

Creating SpamAssassin Configuration Files

  • Log onto a Linux machine in Th 123. Or you can log onto quark.
  • You will need to create two files, .forward and .procmailrc, in your home directory.
  • You can use any editor to do this, e.g. vi, emacs, pico, kedit, etc .
  • Place the following text in your .forward file:
    	# Exim filter
    
    	if error_message then finish endif
    
    	pipe "/usr/local/bin/procmail -f-"
    
  • Place the following text in your .procmailrc file:
    	# .procmailrc
    
    	# Aim all mail at spamassassin
    
    	:0fw: $HOME/spamc.lock
    	| /usr/local/bin/spamc -f
    
    	# Then pipe it into a mailbox "Spam"
    	:0:
    	* ^X-Spam-Status: Yes
    	$HOME/mail/spam
    

Forwarding email and using a .procmail file

  • In case you are forwarding your email to another location, you would modify the .procmailrc file to add the following lines at the end:
    	# Forward to another acccount on another machine
    	# Keep local copy and forward to user@another_machine
    
    	:0 c
    	*
    	! user@another_machine
    
  • So the final .procmailrc file would look like:
            # .procmailrc
    
            # Aim all mail at spamassassin
    
            :0fw: $HOME/spamc.lock
            | /usr/local/bin/spamc -f
    
            # Then pipe it into a mailbox "Spam"
            :0: 
            * ^X-Spam-Status: Yes
            $HOME/mail/spam
    
            # Forward to another acccount on another machine
    	# Keep local copy and forward to user@another_machine
    
            :0 c
            *
            ! user@another_machine
    
  • NOTE: If you do not want to keep a local copy, then remove the letter c from the line ":0 c".

Sample .forward and .procmail files

  • Here are some links to copy the .forward and .procmailrc files. .procmailrc-forward can be used if you want to forward your email. Just rename the file to .procmailrc and change user@another_machine to the email address that you are forwarding to. To allow multiple email addresses, just separate the email addresses by a space, e.g.
    	! user1@machine1 user2@machine2 user3@machine3 and so on
    
    .forward .procmailrc .procmailrc-forward
webwiz@stars.sfsu.edu