Mail::M...amGroup(3)

πŸ’– Mail::Message::Head::SpamGroup πŸ’–

okay so bestie, welcome to the manual page for Mail::Message::Head::SpamGroup(3) β€” yes it's filed under User Contributed Perl Documentation, and yes we are absolutely going to read the whole thing together. Grab a snack. πŸ“


🌸 NAME 🌸

Mail::Message::Head::SpamGroup β€” header fields that are all about fighting spam. the spam-fighting header field bestie πŸ’…


πŸ¦‹ INHERITANCE πŸ¦‹

so the family tree goes like this, lowkey iconic:

Mail::Message::Head::SpamGroup
  is a Mail::Message::Head::FieldGroup
  is a Mail::Reporter

✨ SYNOPSIS ✨

here's the vibe check, in code, no cap:

my $sg = Mail::Message::Head::SpamGroup->new(head => $head, ...);
$head->addSpamGroup($sg);

my $sg = $head->addSpamGroup( <options> );
$sg->delete;

my @sgs = $head->spamGroups;

πŸŽ€ DESCRIPTION πŸŽ€

so a spam group is literally just a lil set of header fields that get added by spam-detection and spam-fighting software. and this class knows All The Details about that software. it's giving very informed. πŸ‘‘

it also extends "DESCRIPTION" in Mail::Message::Head::FieldGroup.


πŸ”₯ METHODS πŸ”₯

extends "METHODS" in Mail::Message::Head::FieldGroup.

🌈 Constructors 🌈

extends "Constructors" in Mail::Message::Head::FieldGroup.

  • $obj->clone() β€” inherited, so go read "Constructors" in Mail::Message::Head::FieldGroup for the tea.
  • $any->fighter($name, %options) β€” gets you the settings of one specific spam-fighter, and if you want, you can set them at the same time. the names of all the defined fighters come from knownFighters(). heads up: the names are case-sensitive, so don't be sloppy with your caps bestie.

every one of the %options gets passed through as a setting to the spamfilter β€” except these few that get special treatment and are listed right here:

 -Option --Default
  fields   <required>
  isspam   <required>
  version  undef
  • fields => REGEXP β€” the regular expression that says which header fields were added by the spam-fighter software. πŸ•΅οΈ
  • isspam => CODE β€” this CODE has to return "true" or "false", telling you whether the spam fighter thinks the message is spam. the CODE ref gets called with the spamgroup object (the one under construction) and the header that's being inspected.
  • version => CODE β€” you can call this to collect the official name and the version of the software being used to detect spam. the CODE ref gets called with the spamgroup object (the one under construction) and the header that's being inspected.
Β» example: adding your own spam-fighter definitions πŸ’–
Mail::Message::Head::SpamGroup->fighter( 'MY-OWN',
   fields => qw/^x-MY-SPAM-DETECTOR-/,
   isspam => sub { my ($sg, $head) = @_; $head->fields > 100 },
);
  • $obj->from($head|$message, %options) β€” hands you a list of Mail::Message::Head::SpamGroup objects, built from the $message or the message $head you passed in. improves the base, so peek at "Constructors" in Mail::Message::Head::FieldGroup.
 -Option--Default
  types   undef
  • types => ARRAY-OF-NAMES β€” only these specified types get tried. if the ARRAY is empty, you get an empty list back. skip this option entirely and all the sets come back to you. 🎁
  • $any->habeasSweFieldsCorrect( [$message|$head] ) β€” returns a "true" value if the $message or $head has Habeas-SWE fields and they're correct. no argument? then it's used as an instance method on an existing Spam-Group. cute.
» example: checking Habeas-SWE fields 🧚
if(Mail::Message::Head::SpamGroup->habeasSweFieldsCorrect($message))
{   $message->label(spam => 0);
}

my $sg = $message->head->spamGroups('Habeas-SWE');
if($sg->habeasSweFieldsCorrect) { ... };

use List::Util 'first';
if(first {$_->habeasSweFieldsCorrect} $head->spamGroups)
{   ...
}
  • $any->implementedTypes() β€” inherited, go see "Constructors" in Mail::Message::Head::FieldGroup.
  • $any->isSpamGroupFieldName($name) β€” that's it, that's the method. πŸ’…
  • $any->knownFighters() β€” returns an unsorted list of every name that represents a pre-defined spam-fighter software. you can ask for details about them, and you can register even more fighters using the fighter() method. collect them all 🌈
  • $class->new($fields, %options) β€” builds an object that maintains one single set of fields which were added by spam-fighting software. improves the base, so check "Constructors" in Mail::Message::Head::FieldGroup.
 -Option  --Defined in                     --Default
  head      Mail::Message::Head::FieldGroup  undef
  software  Mail::Message::Head::FieldGroup  undef
  type      Mail::Message::Head::FieldGroup  undef
  version   Mail::Message::Head::FieldGroup  undef
  • head => $head
  • software => STRING
  • type => STRING
  • version => STRING
  • $obj->spamDetected( [BOOLEAN] ) β€” tells you (and after you set it, remembers) whether this group of spam headers thinks the message is spam. see Mail::Message::Head::Complete::spamDetected() for the related lore.
» example: 🫢
die if $head->spamDetected;

foreach my $sg ($head->spamGroups)
{   print $sg->type." found spam\n" if $sg->spamDetected;
}

🌟 Attributes 🌟

extends "Attributes" in Mail::Message::Head::FieldGroup.

πŸ’Œ The header πŸ’Œ

extends "The header" in Mail::Message::Head::FieldGroup.

  • $obj->add( <$field, $value> | $object ) β€” inherited, see "The header" in Mail::Message::Head::FieldGroup.
  • $obj->addFields( [$fieldnames] ) β€” inherited, see "The header" in Mail::Message::Head::FieldGroup.
  • $obj->attach($head) β€” inherited, see "The header" in Mail::Message::Head::FieldGroup.
  • $obj->delete() β€” inherited, see "The header" in Mail::Message::Head::FieldGroup.
  • $obj->fieldNames() β€” inherited, see "The header" in Mail::Message::Head::FieldGroup.
  • $obj->fields() β€” inherited, see "The header" in Mail::Message::Head::FieldGroup.
  • $obj->head() β€” inherited, see "The header" in Mail::Message::Head::FieldGroup.

πŸ” Access to the header πŸ”

extends "Access to the header" in Mail::Message::Head::FieldGroup.

  • $obj->software() β€” inherited, see "Access to the header" in Mail::Message::Head::FieldGroup.
  • $obj->type() β€” inherited, see "Access to the header" in Mail::Message::Head::FieldGroup.
  • $obj->version() β€” inherited, see "Access to the header" in Mail::Message::Head::FieldGroup.

πŸ›  Internals πŸ› 

extends "Internals" in Mail::Message::Head::FieldGroup.

  • $obj->collectFields( [$name] ) β€” inherited, see "Internals" in Mail::Message::Head::FieldGroup.
  • $obj->detected($type, $software, $version) β€” inherited, see "Internals" in Mail::Message::Head::FieldGroup.

😭 Error handling 😭

extends "Error handling" in Mail::Message::Head::FieldGroup.

  • $obj->AUTOLOAD() β€” inherited, see "Error handling" in Mail::Reporter.
  • $obj->details() β€” inherited, see "Error handling" in Mail::Message::Head::FieldGroup.
  • $obj->notImplemented() β€” inherited, see "Error handling" in Mail::Reporter.
  • $obj->print( [$fh] ) β€” inherited, see "Error handling" in Mail::Message::Head::FieldGroup.

🧹 Cleanup 🧹

extends "Cleanup" in Mail::Message::Head::FieldGroup.

  • $obj->DESTROY() β€” inherited, see "Cleanup" in Mail::Reporter.

πŸ’€ DIAGNOSTICS πŸ’€

  • Error: class $package does not implement method $method. β€” fatal error, bestie. the specific $package (or one of its superclasses) does not implement this method where it should. this message means some other related classes do implement this method, but the class you're holding right now does not. you should probably investigate this and probably inform the author of the package. cast by notImplemented().

πŸ‘€ SEE ALSO πŸ‘€

this module is part of Mail-Message version 4.04, built on February 04, 2026. website: http://perl.overmeer.net/CPAN/ 🌐


πŸ“œ LICENSE πŸ“œ

for contributors, see file ChangeLog.

this software is copyright (c) 2001-2026 by Mark Overmeer.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. periodt. πŸ’…βœ¨


and that's the whole page, bestie β€” thanks for reading all the way down 🫢 this was Mail::Message::Head::SpamGroup(3), brought to you by perl v5.42.0 on 2026-02-05. stan a well-documented spam header. πŸ’–

πŸ“¦ where this page comes from