new()
Creates a SPF object. There are no arguments to configure this module from the constructor; see the
methods below for changeable options.
add_header(HEADERNAME)
Tell this module to append a header on messages which are not rejected, indicating the SPF result
value and a comment explaining the result. By default, this is enabled with the standard header name
"Received-SPF".
Note that this header is not appended if whitelist_pass(1) is in effect, and a sender is whitelisted
by a SPF "pass" result. This is because whitelisting skips all other mail processing, so this module
cannot add headers at the end of processing.
If HEADERNAME is undef, the header is disabled and will not be appended to any message.
This method returns a reference to the object itself, allowing this method call to be chained.
ignore_softfail(FLAG)
If FLAG is 0, a SPF record resulting in "softfail" will be rejected as if the result were "fail".
If FLAG is 1 (the default), a "softfail" is ignored, treated as if it returned "neutral".
This method returns a reference to the object itself, allowing this method call to be chained.
ignore_tempfail(FLAG)
If FLAG is 0 (the default), a DNS lookup which fails the underlying DNS query (a SPF "error" result)
will cause the milter to return a temporary failure result (SMFIS_TEMPFAIL).
If FLAG is 1, a temporary DNS failure will be treated as if the lookup resulted in an empty record
set (and thus a SPF "none" result).
This method returns a reference to the object itself, allowing this method call to be chained.
local_rules(RULETEXT)
Add one or more SPF rules to try before a "-all" or "?all" record is encountered, in an attempt to
validate the mail. This is useful for enumerating secondary MX servers or non-SRS-compliant
forwarding systems which send mail to this host.
The rules must be contained in a single string, separated by spaces.
This method returns a reference to the object itself, allowing this method call to be chained.
set_message(MESSAGE)
Sets the message used when rejecting messages. This string may contain the substring %M, which will
be replaced by the matching e-mail address, and/or %E, which will be replaced by the SPF explanatory
URL and text.
This method returns a reference to the object itself, allowing this method call to be chained.
whitelist_pass(FLAG)
If FLAG is 0 (the default), a SPF "pass" result will be treated like any other non-failure result,
allowing the message to pass through without other special handling.
If FLAG is 1, a SPF "pass" result will cause this module to return SMFIS_ACCEPT, a value that is used
by the accept_break(1) behavior of Mail::Milter::Chain, to ignore the results of other modules in the
chain. Note that because SPF does not accept or reject until the MAIL FROM: stage, it may be
necessary to embed a DeferToRCPT wrapper into the whitelisting chain. For example,
use Mail::Milter::Chain;
use Mail::Milter::Module::SPF;
use Mail::Milter::Wrapper::DeferToRCPT;
my $spf_whitelisted_chain = new Mail::Milter::Chain(
&SPF->whitelist_pass(1),
&DeferToRCPT(new Mail::Milter::Chain(
$milter1, ...
))
)->accept_break(1);
This method returns a reference to the object itself, allowing this method call to be chained.