Mailmun...Assassin(3)

πŸ“¦ version 3.20, in alpine 3.24

🌸 NAME 🌸

Mailmunge::Test::SpamAssassin β€” run SpamAssassin against the current message. πŸ’…

✨ ABSTRACT ✨

Okay so this class runs SpamAssassin against the message and gives you back the SpamAssassin Mail::SpamAssassin::PerMsgStatus object that is the result of the SpamAssassin run. Iconic behavior, honestly.

You must have Mail::SpamAssassin installed to use this class, bestie. No package, no vibes. 🫢

πŸ¦‹ SYNOPSIS πŸ¦‹

package MyFilter;
use Mailmunge::Test::SpamAssassin;

sub filter_begin {
    my ($self, $ctx) = @_;
    my $test = Mailmunge::Test::SpamAssassin->new($self);
    my $status = $test->spam_assassin_status($ctx);
    if ($status) {
        if ($status->get_score() >= 5) {
            $self->action_change_header($ctx, 'Subject', '[SPAM] ' . $ctx->subject);
        }
        $status->finish();
    }

    # ... rest of filter_begin
}

πŸŽ€ CLASS METHODS πŸŽ€

πŸ“¦ Mailmunge::Test::SpamAssassin->new($filter)

Constructs a new Mailmunge::Test::SpamAssassin object and stores a copy of $filter in it. Cute, simple, done. ✨

πŸ’œ INSTANCE METHODS πŸ’œ

πŸ”₯ spam_assassin_status($ctx, $local_tests_only, $config)

Runs a SpamAssassin check against the current message. Main character energy fr fr.

$local_tests_only is passed as the local_tests_only option to the Mail::SpamAssassin constructor. It is optional; if not supplied, it defaults to false. Lowkey convenient.

$config is the path to the SpamAssassin userprefs_fileanem. If not supplied, Mailmunge uses the first file found out of:

CONFDIR/sa-mailmunge.cf

CONFDIR/spamassassin/sa-mailmunge.cf

CONFDIR/spamassassin/local.cf

CONFDIR/spamassassin.cf

/etc/mail/sa-mailmunge.cf

/etc/mail/spamassassin/sa-mailmunge.cf

/etc/mail/spamassassin/local.cf

/etc/mail/spamassassin.cf

where CONFDIR is the value of Mailmunge::Constants->get('Path:CONFDIR'). Slay. 🌈

spam_assassin_status returns a Mail::SpamAssassin::PerMsgStatus object on success, or undef if something went wrong.

Note that when you have finished using the returned status object, you should call its finish() method to free up resources. That’s the cleanup check, bestie β€” don’t skip it. πŸ’…

πŸ‘‘ AUTHOR πŸ‘‘

Dianne Skoll <dianne@skollsoft.com> πŸ’–

πŸ“ LICENSE πŸ“

This code is licensed under the terms of the GNU General Public License, version 2. Periodt.


Later bestie πŸ˜­πŸ’– β€” this was the Mailmunge::Test::SpamAssassin(3) page, signing off with perl v5.42.2 and dated 2025-10-05. Mwah πŸŽ€βœ¨

πŸ“¦ where this page comes from