NAME

Mail::MIMEDefang::Async::Results - Interpret async check output for MIMEDefang

DESCRIPTION

Mail::MIMEDefang::Async::Results translates raw output from md_async_run_checks() into actionable filter decisions (reject, tempfail, score, pass).

SYNOPSIS

use Mail::MIMEDefang::Async::Results;

my $dnsbl = md_async_interpret_dnsbl(
    records => $result->{results}{zen},
    zone    => 'zen.spamhaus.org',
    error   => $result->{errors}{zen},
);

my $score = md_async_score_results(
    interpreted => { zen => $dnsbl },
    reject_at   => 5.0,
);

if ($score->{action} eq 'REJECT') {
    return action_bounce("550 5.7.1 " . $score->{reasons}[0]);
}

METHODS

md_async_interpret_dnsbl(%args)

Interpret a DNSBL result. Args: records (arrayref or undef), zone, error. Returns a hashref with keys listed, code, reason, and optionally error.

md_async_interpret_spamassassin(%args)

Parse a raw SPAMC protocol response. Args: raw, error, threshold (default 5.0). Returns is_spam, score, threshold, symbols, reason.

md_async_interpret_clamav(%args)

Interpret a clamd PING or INSTREAM response. Args: raw, error. Returns available, virus, name, reason.

md_async_interpret_rdns(%args)

Interpret a PTR record result. Args: records, error, ip. Returns has_rdns, ptr, dynamic, reason.

md_async_interpret_spf_txt(%args)

Check whether a TXT record lookup returned an SPF record. Args: records, error, domain. Returns has_spf, record, reason.

md_async_interpret_dmarc($raw)

Parse a raw DMARC TXT policy string (as returned by md_async_dmarc_verify() or from the records of md_async_check_dmarc_record()).

Returns a hashref with keys: has_dmarc, policy, subdomain_policy, pct, rua, ruf, adkim, aspf, reason.

md_async_score_results(%args)

Tally individual interpreted check results into a weighted spam score. Args: interpreted (hashref of name->interp result), weights (optional override), reject_at (default 8.0), tempfail_at (default 12.0).

Returns { score, action, reasons } where action is one of 'PASS', 'REJECT', 'TEMPFAIL'.

SEE ALSO

Mail::MIMEDefang::Async, Mail::MIMEDefang::Async::Checks