Caltech Home > GPS Home > Facilities & Resources > Computing > Configuring Spam Mail Filters
open search form

Configuring Spam Mail Filters

General instructions

General instructions

The message filter criteria is the presence of the x-header:

X-Barracuda-Spam-Flag: YES

Depending on your mail client software, you may have the choice to configure your filter to move the messages with that flag to a separate folder, to change their priority, to mark the messages as special, to mark them as read, to delete them, or a few other options.

GPS recommends choosing to filter messages with the X-Barracuda-Spam-Flag: YES header to a separate folder called "spam" or "junkmail". That way, you can periodically check the folder to make sure no real, possibly important, messages have been flagged by mistake. Every so often, check that spam folder to be sure no messages of value were put there in error, and then bulk-delete the contents of that folder.


Advice About Specific Email Clients


When you create a filter on a header, if the header isn't in the pull-down list (which this one won't be), you can overtype into the blank where the pull-down menu is and simply type in the header to search (X-Barracuda-Spam-Flag in this case).

   1. Go to Tools/Filter/New and then type "X-Barracuda-Spam-Flag" (without the quotes) into the Header window.
   2. Click Incoming and Manual options under Match (but don't select Outgoing). That way when you've finished creating the filter you can test it by doing a Manual run of the filter.
   3. For the match, select Contains and then type (or paste) YES.
   4. For Action, you can do Transfer To and then make a special mailbox for spam, or you can even just flag it in your inbox by changing its color.
   5. Save before you exit the Filters window.
   6. Test the new filter by doing Select All in your inbox, and then Special/Filter Messages.

Let us know if you have trouble. If you do encounter a problem, we'd like to know the version of Eudora you're using. We've not created filters using every version, and it's possible there will be some variation between the filtering capabilities of various versions.


   1. Go to Tools->Rules Wizard...
   2. Click 'New...' (on the top right)
   3. Choose 'Check messages when they arrive'
   4. Click 'Next'.
   5. Check 'With specific words in the message header'.
   6. Click on 'specific words'.
   7. Type in: X-Barracuda-Spam-Flag: YES (one space between the : and the Y)
   8. Click 'Ok'.
   9. Click 'Next'.
  10. Check 'Move it to the specified folder'.
  11. Click on 'specified'.
  12. Highlight an existing folder, or create a new one.
  13. Click 'Ok'.
  14. Click 'Next'.
  15. Click 'Next'. (Again, unless you want to add exceptions.)
  16. Give the rule a name. (The default is what you typed for specific words above.)
  17. Check 'Turn on this rule'. (You may or may not want to check 'Run this rule on my Inbox now'.)
  18. Click 'Finish'.

Mac OS X Mail

Mac OS X's built-in Mail program can create filters based on custom headers.

   1. In the menu bar click 'Mailbox' then 'New Mailbox' and create the mailbox
      you want the spam to end up in.
   2. In the menu bar click 'Mail' then 'Preferences...'
   3. Click 'Rules' then 'Create Rule'
   4. Add a description of the rule, then click the 'From' Criteria then
      click 'Expert...'
   5. In the Header: field enter 'X-Barracuda-Spam-Flag', click 'Add Header' and 'OK'
   6. Now click 'From' and select 'X-Barracuda-Spam-Flag', select 'Contains' in the
      next box and enter 'YES' in the third Criteria box.
   7. In the Action section check 'Transfer to mailbox' and select the
      desired mailbox. click 'OK'
   8. Adjust the rule priorities if you want and dismiss the Mail Preferences
      dialog box.
   9. The next time you check your mail, check to see if any messages were automatically filtered into your spam mailbox!


The mutt philosophy is to make it easy for you do do things after reading your email. It assumes you are using something like procmail if you want to distribute your email to various places before you start reading.

If you use procmail to, for example, distribute your email to /home/yourname/mail/spam and /home/yourname/mail/goodmail you need to add a line like this to your /home/yourname/.muttrc file (or your /home/yourname/mutt/muttrc file):

mailboxes /home/yourname/mail/goodmail /home/yourname/mail/spam

that will tell mutt where to look for new mail. You can also indicate which messages have been marked as possible spam on the index page by adding:

mono index bold "~h \'X-Barracuda-Spam-Flag: YES"


Start from pine's main menu.

   1. Press S for Setup.
   2. Press R for Rules; then press F for Filters.
   3. Press A for Add.
   4. Initially, the Nickname field should be highlighted. Select it by pressing enter/return, then set the nickname to "Spam Filter".
   5. Press X to add another header. Enter "X-Barracuda-Spam-Flag". After you do this, the line allowing you to set the match pattern for X-Barracuda-Spam-Flag should be highlighted. Press enter/return, then as the text to be added enter YES (all caps).
   6. Check the CURRENT FOLDER CONDITIONS BEGIN HERE section. Make sure that the Specific option is set and the Folder List is "INBOX". If not, make the required changes so that that is the configuration.
   7. Scroll down to the ACTIONS BEGIN HERE section. Make sure the Filter Action option is set to Move. Select the Folder List item in that section, and set it to "spam".
   8. Press E for Exit Setup and press Y to commit the change. You may be asked to create the spam folder; accept that change if this happens.
   9. Press E again for Exit Setup and press Y to commit the change.

At this point your filtering setup is in place; whenever you read mail, suspected spam will wind up in the "spam" folder in the "mail" directory within your home directory.