The Amavis::check_mail function

Table of Contents

1. Arguments
1.1. $conn: Amavis::In::Connection object
1.2. $msginfo: Amavis::In::Message object
1.3. $dsn_per_recip_capable
2. Return value
2.1. SMTP response
2.2. Exit code
2.3. Preserve evidence
3. Per-recipient handling
4. Header edits
5. Policy banks
6. Temporary directory
6.1. Creating the temporary directory
6.2. Creating email file
6.3. Cleaning the temporary directory
6.4. Deleting the temporary directory

The Amavis::check_mail function is the main MTA-independent mail checking function, which performs all the work of running content scanners and deciding message destinies. It also handles quarantining, recipient/admin notification messages, and forwarding the message or sending a DSN in cases where that is amavisd-new's responsibility.

For each message, before calling check_mail you must call Amavis::check_mail_begin_task which clears the values of several variables. Amavis::In::SMTP calls this upon receiving the MAIL FROM command. Other packages call it immediately before calling check_mail.

A reference to the check_mail function is passed as an argument to the MTA request function. It takes three arguments, described below.