The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Mail::SpamAssassin::Plugin::AttachmentPresent - SpamAssassin plugin to score mail based on attachments including attachments inside archives.

SYNOPSIS

  loadplugin Mail::SpamAssassin::Plugin::AttachmentPresent
  body RULENAME eval:attachmentpresent_archive_count()
  body RULENAME eval:attachmentpresent_file_count()

DESCRIPTION

Get information about attached files, including inside archives. Only supports Zip right now.

CONFIGURATION

None

INSTALL

Install the required Perl modules:
  Encode::MIME::Header;
  Archive::Zip
  IO::String
  Mail::SpamAssassin::Plugin::AttachmentPresent

Should already be installed by spamassassin

Configure spamassassin

Typically in local.cf, include lines: loadplugin Mail::SpamAssassin::Plugin::AttachmentPresent

  body HAS_JS_FILES eval:attachmentpresent_file_count('js')
  describe HAS_JS_FILES The e-mail has attached javascript files (or inside archives)
  score HAS_JS_FILES 0.001

FUNCTIONS

$int = attachmentpresent_archive_count([$ext[, $more_than]])

Returns the amount of recognised archive files inside this message. Currently only Zip files are recognised. If the file could not be parsed because it was too big or corrupted, its not counted.

Optionally you can filter on extension, where $ext should be set to the extension to filter on. Eg. $ext='zip'

$int = attachmentpresent_file_count([$ext[, $more_than]])

Returns the amount of files inside this message. It also counts files inside recognised archive files. Currently only Zip files are recognised.

Optionally you can filter on extension, where $ext should be set to the extension to filter on. Eg. $ext='js'

Optionally you can specify the minimum amount of files (of the given type) which will be required to trigger the rule. By default $more_than is 0, so at least one file of the given type is needed, but you can set it to 4 if you want the rule to trigger when at least 5 files are present.