How to Whitelist a Sender or Domain in SpamAssassin

Female technician working in server room
You may not even have to sit down to set up SpamAssassin to whitelist senders. StockUnlimited

Set up SpamAssassin to always allow certain senders, even automatically.

One Rule to Supersede the Others

Using its comprehensive set of rules and Bayesian analysis, SpamAssassin catches an impressive amount of spam with hardly any false positives.

—Hardly any; to reduce this number even further, you can whitelist certain newsletters, for instance, which tend to be top candidates for being erroneously classified as spam.

Whitelist a Sender or Domain in SpamAssassin

To whitelist individual addresses or domains in SpamAssassin:

  1. Open /etc/mail/spamassassin/local.cf in your favorite editor for system-wide whitelisting.
    1. To whitelist only for yourself, open ~/.spamassassin/user_prefs.
  2. Append "whitelist_from_rcvd {address or domain you want to whitelist preceded by "*@"} {domain name which must be present in the Received: headers}".
    • To whitelist all email from example.com, for example, type "whitelist_from_rcvd *@about.com about.com".

The second parameter of whitelist_from_rcvd, a domain name which must be present in the Received: header lines, is some prevention against spammers easily getting past SpamAssassin by using an email address at a commonly whitelisted domain.

What "AutoWhitelist" Means in SpamAssassin and How It Works

SpamAssasin offers plug-ins that let you automate whitelisting senders—not necessarily and not only in the manner you would assume, though.

Both the older AWL (AutoWhitelist) and the new, improved TxRep plug-ins will monitor sending email addresses over time. Based on the reputation so built for addresses, the plug-ins will then adjust the spam score for an individual new message for each sender.

If you received nothing but good mail from an address in the past, for example, just about anything they send now will be treated as good mail; even if they essentially forward a junk email, this message will pass through SpamAssassin unscathed with the help of AWL or TxRep.

The sender will essentially be whitelisted.

Of course, that latest email will be factored into the sender's reputation for the future, and repeated bad messages can modify it so that the sender is no longer "whitelisted".

As a corollary, even the purest email from an address that has sent nothing but spam in the past will be treated as junk with AWL or TxRep enabled for SpamAssassin—with that good message slightly modifying the sender's reputation for the future.

Use SpamAssassin TxRep to Whitelist Addresses You Email

The TxRep SpamAssassin plug-in also includes the ability to watch the emails you send and automatically improve the reputation of each recipient address in each outgoing email, effectively whitelisting people you email, and especially if you email them repeatedly.

To have TxRep automatically improve the reputation of addresses you email:

  1. Make sure the TxRep plug-in is installed for SpamAssassin.
  2. Make sure, also, that SpamAssassin is configured to process outgoing mail and that your email programs are configured to send through the local SMTP server (which allows SpamAssassin to process that mail).
  3. Open /etc/mail/spamassassin/local.cf in your favorite editor for system-wide whitelisting.
    • To whitelist only for yourself, open ~/.spamassassin/user_prefs.
  1. Add or edit the "txrep_whitelist_out" entry to a value from 0 to 200.
    • Every time TxRep encounters an email address, it will add txrep_whitelist_out to the sender's reputation score; the value increases over time as you email the same person repeatedly.
    • The default value for txrep_whitelist_out is 10.