Scroll to navigation

Mail::Message::Head::SpamGroup(3pm) User Contributed Perl Documentation Mail::Message::Head::SpamGroup(3pm)

NAME

Mail::Message::Head::SpamGroup - spam fighting related header fields

INHERITANCE

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

SYNOPSIS

  my $sg = Mail::Message::Head::SpamGroup->new(head => $head, ...);
  $head->addSpamGroup($sg);
  my $sg = $head->addSpamGroup( <options> );
  $sg->delete;
  my @sgs = $head->spamGroups;

DESCRIPTION

A spam group is a set of header fields which are added by spam detection and spam fighting software. This class knows various details about that software.

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, see "Constructors" in Mail::Message::Head::FieldGroup
$any->fighter($name, %options)
Get the settings of a certain spam-fighter, optionally after setting them. The knownFighters() method returns the defined names. The names are case-sensitive.

The %options are all passed as settings to the spamfilter, except the few which are listed here specifically.

 -Option --Default
  fields   <required>
  isspam   <required>
  version  undef
    
The regular expression which indicates which of the header fields are added by the spam fighter software.
The CODE must return "true" or "false", to indicate whether the spam fighter thinks that the message contains spam. The CODE ref is called with the spamgroup object (under construction) and the header which is inspected.
Can be called to collect the official name and the version of the software which is used to detect spam. The CODE ref is called with the spamgroup object (under construction) and the header which is 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)
Returns a list of "Mail::Message::Head::SpamGroup" objects, based on the specified $message or message $head. Improves base, see "Constructors" in Mail::Message::Head::FieldGroup

 -Option--Default
  types   undef
    
Only the specified types will be tried. If the ARRAY is empty, an empty list is returned. Without this option, all sets are returned.
$any->habeasSweFieldsCorrect( [$message|$head] )
Returns a "true" value if the $message or $head contains "Habeas-SWE" fields which are correct. Without argument, this is used as instance method on an existing Spam-Group.

» 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, see "Constructors" in Mail::Message::Head::FieldGroup
$any->isSpamGroupFieldName($name)

$any->knownFighters()
Returns an unsorted list of all names representing pre-defined spam-fighter software. You can ask details about them, and register more fighters with the fighter() method.
$class->new($fields, %options)
Construct an object which maintains one set of fields which were added by spam fighting software. Improves base, see "Constructors" in Mail::Message::Head::FieldGroup

 -Option  --Defined in                     --Default
  head      Mail::Message::Head::FieldGroup  undef
  log       Mail::Reporter                   'WARNINGS'
  software  Mail::Message::Head::FieldGroup  undef
  trace     Mail::Reporter                   'WARNINGS'
  type      Mail::Message::Head::FieldGroup  undef
  version   Mail::Message::Head::FieldGroup  undef
    
$obj->spamDetected( [BOOLEAN] )
Returns (after setting) whether this group of spam headers thinks that this is spam. See Mail::Message::Head::Complete::spamDetected().

» 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.

$obj->logSettings()
Inherited, see "Attributes" in Mail::Reporter

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->addReport($object)
Inherited, see "Error handling" in Mail::Reporter
$any->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )
Inherited, see "Error handling" in Mail::Reporter
$obj->details()
Inherited, see "Error handling" in Mail::Message::Head::FieldGroup
$obj->errors()
Inherited, see "Error handling" in Mail::Reporter
$any->log( [$level, [$strings]] )
Inherited, see "Error handling" in Mail::Reporter
$any->logPriority($level)
Inherited, see "Error handling" in Mail::Reporter
$obj->notImplemented()
Inherited, see "Error handling" in Mail::Reporter
$obj->print( [$fh] )
Inherited, see "Error handling" in Mail::Message::Head::FieldGroup
$obj->report( [$level] )
Inherited, see "Error handling" in Mail::Reporter
$obj->reportAll( [$level] )
Inherited, see "Error handling" in Mail::Reporter
$obj->trace( [$level] )
Inherited, see "Error handling" in Mail::Reporter
$obj->warnings()
Inherited, see "Error handling" in Mail::Reporter

Cleanup

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

$obj->DESTROY()
Inherited, see "Cleanup" in Mail::Reporter

DIAGNOSTICS

Fatal error: the specific package (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by notImplemented()

SEE ALSO

This module is part of Mail-Message version 3.019, built on November 24, 2025. Website: http://perl.overmeer.net/CPAN/

LICENSE

For contributors see file ChangeLog.

This software is copyright (c) 2001-2025 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.

2025-12-07 perl v5.40.1