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 fromknownFighters(). 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 ofMail::Message::Head::SpamGroupobjects, built from the$messageor the message$headyou 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$messageor$headhasHabeas-SWEfields 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 thefighter()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 => $headsoftware => STRINGtype => STRINGversion => STRING
$obj->spamDetected( [BOOLEAN] )β tells you (and after you set it, remembers) whether this group of spam headers thinks the message is spam. seeMail::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
$packagedoes 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 bynotImplemented().
π 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
- fedora 44: perl-Mail-Message 4.04-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms