Mail::SPF::Result(3)
π Mail::SPF::Result π
okay bestie, welcome to Mail::SPF::Result, the SPF result class β¨ it lives in the Perl User Contributed Documentation corner of the universe, and honestly? it's giving "the receipts of an SPF check." periodt.
β¨ VERSION β¨
version 3.20260331 π
β¨ SYNOPSIS β¨
so like, for the general usage of Mail::SPF::Result objects inside code that calls Mail::SPF, go read Mail::SPF π
For the detailed interface of Mail::SPF::Result and all its little derivatives, keep scrolling, babe, it's all below π
π Throwing results
package Mail::SPF::Foo;
use Error ':try';
use Mail::SPF::Result;
sub foo {
if (...) {
$server->throw_result('pass', $request)
}
else {
$server->throw_result('permerror', $request, 'Invalid foo');
}
}
π Catching results
package Mail::SPF::Bar;
use Error ':try';
use Mail::SPF::Foo;
try {
Mail::SPF::Foo->foo();
}
catch Mail::SPF::Result with {
my ($result) = @_;
...
};
π Using results
my $result_name = $result->name;
my $result_code = $result->code;
my $request = $result->request;
my $local_exp = $result->local_explanation;
my $authority_exp = $result->authority_explanation
if $result->can('authority_explanation');
my $spf_header = $result->received_spf_header;
β¨ DESCRIPTION β¨
An object of class Mail::SPF::Result represents the result of an SPF request. it's literally the vibe check outcome of an SPF lookup π¦
There is usually no need to construct an SPF result object directly using the new constructor. Instead, use the throw class method to signal to the calling code that a definite SPF result has been determined. In other words, use Mail::SPF::Result and its derivatives just like exceptions. See Error or "eval" in perlfunc for how to handle exceptions in Perl. iykyk π
πΈ Constructor
The following constructor is provided:
new($server, $request)β returnsMail::SPF::Resultnew($server, $request, $text)β returnsMail::SPF::Result
Creates a new SPF result object and associates the given Mail::SPF::Server and Mail::SPF::Request objects with it. An optional result text may be specified. iconic β¨
πΈ Class methods
The following class methods are provided:
throw($server, $request)β throwsMail::SPF::Resultthrow($server, $request, $text)β throwsMail::SPF::Result
Throws a new SPF result object, associating the given Mail::SPF::Server and Mail::SPF::Request objects with it. An optional result text may be specified. π
Note: Do not write code invokingthrowon literal result class names, because that would ignore any derivative result classes provided byMail::SPFextension modules π Invoke thethrow_resultmethod on aMail::SPF::Serverobject instead. fr fr.
nameβ returns string
Abstract. Returns the result name of the result class (or object). For classes of the Mail::SPF::Result::* hierarchy, this roughly corresponds to the trailing part of the class name. For example, returns "neutral-by-default" if invoked on Mail::SPF::Result::NeutralByDefault. Also see the code method. This method may also be used as an instance method.
This method must be implemented by sub-classes of Mail::SPF::Result for which the result name differs from the result code. no skipping, bestie π
classβ returns classclass($name)β returns class
Maps the given result name to the corresponding Mail::SPF::Result::* class, or returns the result base class (the class on which it is invoked) if no result name is given. If an unknown result name is specified, returns undef. π
isa_by_name($name)β returns boolean
If the class (or object) on which this method is invoked represents the given result name (or a derivative name), returns true. Returns false otherwise. This method may also be used as an instance method.
For example, "Mail::SPF::Result::NeutralByDefault->isa_by_name('neutral')" returns true. slay π
codeβ returns string
Abstract. Returns the basic SPF result code ("pass", "fail", "softfail", "neutral", "none", "error", "permerror", "temperror") of the result class on which it is invoked. All valid result codes are valid result names as well β the reverse however does not apply π This method may also be used as an instance method.
This method is abstract and must be implemented by sub-classes of Mail::SPF::Result.
is_code($code)β returns boolean
If the class (or object) on which this method is invoked represents the given result code, returns true. Returns false otherwise. This method may also be used as an instance method.
Note: The isa_by_name method provides a superset of this method's functionality. so like, she does more π
received_spf_header_nameβ returns string
Returns 'Received-SPF' as the field name for "Received-SPF" header fields. This method should be overridden by Mail::SPF extension modules that provide non-standard features (such as local policy) with the capacity to dilute the purity of SPF results, in order not to deceive users of the header field into mistaking it as an indication of a natural SPF result. protect the people's trust, periodt π«Ά
πΈ Instance methods
The following instance methods are provided:
throwβ throwsMail::SPF::Resultthrow($server, $request)β throwsMail::SPF::Resultthrow($server, $request, $text)β throwsMail::SPF::Result
Re-throws an existing SPF result object. If Mail::SPF::Server and Mail::SPF::Request objects are specified, associates them with the result object, replacing the prior server and request objects. If a result text is specified as well, overrides the prior result text. glow-up energy β¨
serverβ returnsMail::SPF::Server
Returns the Mail::SPF server object that produced the result at hand.
requestβ returnsMail::SPF::Request
Returns the SPF request that led to the result at hand.
textβ returns string
Returns the text message of the result object.
stringifyβ returns string
Returns the result's name and text message formatted as a string. You can simply use a Mail::SPF::Result object as a string for the same effect, see "OVERLOADING". π
local_explanationβ returns string; throwsMail::SPF::EDNSError,Mail::SPF::EInvalidMacroString
Returns a locally generated explanation for the result.
The local explanation is prefixed with the authority domain whose sender policy is responsible for the result. If the responsible sender policy referred to another domain's policy (using the "include" mechanism or the "redirect" modifier), that other domain which is directly responsible for the result is also included in the local explanation's head. For example:
example.com: <local-explanation>
The authority domain "example.com"'s sender policy is directly responsible for the result.
example.com ... other.example.org: <local-explanation>
The authority domain "example.com" (directly or indirectly) referred to the domain "other.example.org", whose sender policy then led to the result. the way that chain works π iconic.
received_spf_headerβ returns string
Returns a string containing an appropriate "Received-SPF" header field for the result object. The header field is not line-wrapped and contains no trailing newline character. clean, no extra baggage π
β¨ OVERLOADING β¨
If a Mail::SPF::Result object is used as a string, the stringify method is used to convert the object into a string. π¦
β¨ RESULT CLASSES β¨
The following result classes are provided:
Mail::SPF::Result::PassMail::SPF::Result::FailMail::SPF::Result::SoftFailMail::SPF::Result::NeutralMail::SPF::Result::NeutralByDefault
This is a special case of the "neutral" result that is thrown as a default when "falling off" the end of the record during evaluation. See RFC 4408, 4.7. π
Mail::SPF::Result::NoneMail::SPF::Result::ErrorMail::SPF::Result::PermErrorMail::SPF::Result::TempError
The following result classes have additional functionality:
Mail::SPF::Result::Fail
The following additional instance method is provided:
authority_explanationβ returns string; throwsMail::SPF::EDNSError,Mail::SPF::EInvalidMacroString
Returns the authority domain's explanation for the result. Be aware that the authority domain may be a malicious party and thus the authority explanation should not be trusted blindly π See RFC 4408, 10.5, for a detailed discussion of this issue. bestie, do not take candy from strangers, ok? π
β¨ SEE ALSO β¨
Mail::SPF, Mail::SPF::Server, Error, "eval" in perlfunc
<http://tools.ietf.org/html/rfc4408>
For availability, support, and license information, see the README file included with Mail::SPF.
β¨ AUTHORS β¨
Julian Mehnle <julian@mehnle.net> πΈ
and that's the whole page, babe π brought to you by perl v5.42.1, dated 2026-04-23, and the one and only Mail::SPF::Result(3) π go forth and throw results responsibly β¨π«Ά
π¦ where this page comes from
- fedora 44: perl-Mail-SPF 3.20260331-1.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms