Mail::SpamAssassin::SQLBasedAddrList − SpamAssassin SQL Based Auto Whitelist


    my $factory = Mail::SpamAssassin::SQLBasedAddrList−>new()
    $spamtest−>set_persistent_addr_list_factory ($factory);
  ... call into SpamAssassin classes...

SpamAssassin will call:

    my $addrlist = $factory−>new_checker($spamtest);
    $entry = $addrlist−>get_addr_entry ($addr, $origip);


A SQL based persistent address list implementation.

See "Mail::SpamAssassin::PersistentAddrList" for more information.

Uses DBI::DBD module access to your favorite database (tested with MySQL, SQLite and PostgreSQL) to store user auto-whitelists.

The default table structure looks like this: CREATE TABLE awl (
username varchar(100) NOT NULL default ’’,
email varchar(255) NOT NULL default ’’,
ip varchar(16) NOT NULL default ’’,
count int(11) NOT NULL default ’0’,
totscore float NOT NULL default ’0’,
signedby varchar(255) NOT NULL default ’’,
PRIMARY KEY (username,email,signedby,ip) ) TYPE=MyISAM;

Your table definition may change depending on which database driver you choose. There is a config option to override the table name.

This module introduces several new config variables:






see "Mail::SpamAssassin::Conf" for more information.

public class (Mail::SpamAssassin::SQLBasedAddrList) new ()

Description: This method creates a new instance of the SQLBasedAddrList factory and calls the parent’s (PersistentAddrList) new method.

public instance (Mail::SpamAssassin::SQLBasedAddrList) new_checker (\% $main)

Description: This method is called to setup a new checker interface and return a blessed copy of itself. Here is where we setup the SQL database connection based on the config values.

public instance (\%) get_addr_entry (String $addr, String $signedby)

Description: This method takes a given $addr and splits it between the email address component and the ip component and performs a lookup in the database. If nothing is found in the database then a blank entry hash is created and returned, otherwise an entry containing the found information is returned. If a with_awl_signer configuration option is enabled only addresses signed by the given signing identity are taken into account, or, if $signedby is undefined (or empty) only unsigned entries are considered.

A key, "exists_p", is set to 1 if an entry already exists in the database, otherwise it is set to 0.

public instance (\%) add_score (\% $entry, Integer $score)

Description: This method adds a given $score to a given $entry. If the entry was marked as not existing in the database then an entry will be inserted, otherwise a simple update will be performed.

NOTE: This code uses a self referential SQL call (ie set foo = foo + 1) which is supported by most modern database backends, but not everything calling itself a SQL database.

public instance () remove_entry (\% $entry)

Description: This method removes a given $entry from the database. If the ip portion of the entry address is equal to "none" then remove any perl-IP entries for this address as well.

public instance () finish ()

Description: This method provides the necessary cleanup for the address list.

private instance (String, String) _unpack_addr(string $addr)

Description: This method splits an autowhitelist address into it’s two components, email and ip address.


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.