The script

The script allows you to send out an e-mail digest to your users, containing an HTML-formatted list of the contents of their Maia Mailguard quarantines, generated from a template. Users can then release items as necessary and confirm the status of the remaining items, all from within their e-mail clients, without having to login to the Maia web interface.

Each user can specify his or her own digest interval (in minutes) from within the Maia Mailguard web interface, and of course enable/disable the feature as desired. The administrator must be sure to run this script from a cron job at whatever minimum interval makes sense for the system's load. In a low-volume environment, it might be practical to run this script from a cron job every minute, offering users an effective granularity of one minute. It may be more practical in most environments to run this script every five minutes or ten minutes, though of course this will limit how frequently the users can receive their digests, obviously. A granularity of five minutes should probably be more than sufficient for most sites, however.

A number of settings in the /etc/maia.conf file control how the digests are formatted:

$base_url lets you specify the base URL to your Maia Mailguard installation, so that URLs in the digest can be made to point properly to your Maia pages. For instance, if your users would normally visit to access your Maia scripts, you'd set $base_url to

# Base URL to Maia's PHP scripts
$base_url = "";

$template_dir tells the script where it can find the digest.tpl template it needs in order to construct the HTML e-mail. If you want to edit the template itself, of course, that's the one to mess with.

# Template directory
$template_dir = "/var/amavisd/maia/templates/";

%sort lets you control how the mail items in the various lists are sorted. There are five different lists:

hamNon-spam e-mails
spamSpam e-mails
virusVirus/Malware?-infected e-mails
banned_fileE-mail containing banned file attachments
bad_headerE-mail with invalid mail headers

There are three different sorting criteria you can choose from for each of those mail types:

scoreSort by the e-mail's score
received_dateSort by the date and time the mail was received
recipient_idSort by the e-mail's recipient ID

For every sorting criterion, you can choose one of two directions to sort:

ASCAscending order, lowest to highest, oldest to newest
DESCDescending order, highest to lowest, newest to oldest

Typically you'll want to sort non-spam ("ham") in descending order by score, so that the items most likely to be false negatives will appear near the top of the list. Similarly, spotting false positives among the spam is easiest when spam is sorted in ascending order by score.

# How you want the sorted (choose one per cache type)
# (note: non spam/ham caches don't have score to sort by)
# options are:
# %sort = "score DIRECTION"
#       = "received_date DIRECTION"
#       = "recipient_id DIRECTION"

%sort = (
            'ham'   => "score DESC",  # puts the high scores at the top
            'spam'  => "score ASC",   # puts the low scroes at the top
            'virus' => "received_date DESC",
            'banned_file' => "received_date DESC",
            'bad_header'  => "received_date DESC",

$titles lets you set the text that appears at the beginning of each section of the digest, for each of the five mail types.

# Heading titles for each section of the digest report

$titles = { 'spam'        =>  "Spam Quarantine",
            'virus'       =>  "Virus Quarantine",
            'banned_file' =>  "Banned File Attachments",
            'bad_header'  =>  "Invalid Email Headers",
            'ham'         =>  "Delivered Email"

@report_order lets you determine the order the five sections appear in the digest, from top to bottom. If you don't want a given section to appear at all (e.g. bad_header), you can omit it from the list entirely.

# The order of the sections of the digest report
# Valid elements are 'spam', 'ham', 'virus', banned_file', and 'bad_header'
# Omit any of these elements to leave them out of the report

@report_order = ('spam','ham','virus','banned_file','bad_header');
Last modified 17 years ago Last modified on Apr 12, 2006, 11:19:06 PM