SPFQUERY(1)
๐ SPFQUERY(1) ๐
okay bestie, so this is a User Contributed Perl Documentation page, and the manual it lives in is SPFQUERY(1). it's about spfquery, which ships with Mail::SPF. strap in, it's giving very "email security but make it a group project". ๐ฆ
โจ NAME โจ
spfquery โ (Mail::SPF) โ checks if a given set of e-mail parameters matches a domain's SPF policy ๐
๐ธ VERSION ๐ธ
version 3.20260331
๐ SYNOPSIS ๐
Preferred usage (this is the main character, ok?):
spfquery [--versions|-v 1|2|1,2] [--scope|-s helo|mfrom|pra]
--identity|--id identity --ip-address|--ip ip-address
[--helo-identity|--helo-id helo-identity] [OPTIONS]
spfquery [--versions|-v 1|2|1,2] [--scope|-s helo|mfrom|pra]
--file|-f filename|- [OPTIONS]
Legacy usage (the old fits, still cute, still works):
spfquery --helo helo-identity --ip-address|--ip ip-address [OPTIONS]
spfquery --mfrom mfrom-identity --ip-address|--ip ip-address [--helo
helo-identity] [OPTIONS]
spfquery --pra pra-identity --ip-address|--ip ip-address [OPTIONS]
Other usage:
spfquery --version|-V
spfquery --help
๐ซถ DESCRIPTION ๐ซถ
so spfquery checks if a given set of e-mail parameters (like, say, the SMTP sender's IP address) matches the responsible domain's Sender Policy Framework (SPF) policy. for more info on SPF see <https://tools.ietf.org/html/rfc7208>. it's literally the vibe check for email senders. ๐
๐ Preferred Usage
these usage forms are preferred over the legacy forms used by older spfquery versions (no cap, they're just better):
the --identity form checks if the given ip-address is an authorized SMTP sender for the given helo hostname, mfrom envelope sender e-mail address, or pra (so-called purported resonsible address) e-mail address, depending on the value of the --scope option (which defaults to mfrom if omitted).
the --file form reads ip-address identity [helo-identity] tuples from the file with the specified filename, or from standard input if filename is -, and checks them against the specified scope (mfrom by default).
both forms support an optional --versions option, which specifies a comma-separated list of the SPF version numbers of SPF records that may be used. 1 means that v=spf1 records should be used. 2 means that spf2.0 records should be used. defaults to 1,2, i.e., uses any SPF records that are available. records of a higher version are preferred. ๐
๐ Legacy Usage
spfquery versions before 2.500 featured the following usage forms, which are discouraged but still supported for backwards compatibility (we keep them around like a nostalgic playlist ๐ง):
the --helo form checks if the given ip-address is an authorized SMTP sender for the HELO hostname given as the identity (so-called "HELO" check).
the --mfrom form checks if the given ip-address is an authorized SMTP sender for the envelope sender email-address (or domain) given as the identity (so-called "MAIL FROM" check). if a domain is given instead of an e-mail address, postmaster will be substituted for the localpart.
the --pra form checks if the given ip-address is an authorized SMTP sender for the PRA (Purported Responsible Address) e-mail address given as the identity.
โญ Other Usage
the --version form prints version information of spfquery. the --help form prints usage information for spfquery.
โจ OPTIONS โจ
๐ Standard Options
the preferred and legacy forms optionally take any of the following OPTIONS:
--default-explanationstring,--def-expstring โ use the specified string as the default explanation if the authority domain does not specify an explanation string of its own.--hostnamehostname โ use hostname as the host name of the local system instead of auto-detecting it.--keep-comments,--no-keep-commentsโ do (not) print any comments found when reading from a file or from standard input.--sanitize(currently ignored),--no-sanitize(currently ignored) โ do (not) sanitize the output by condensing consecutive white-space into a single space and replacing non-printable characters with question marks. enabled by default.--debug(currently ignored) โ print out debug information.
๐ฎ Black Magic Options
several options that were supported by earlier versions of spfquery are considered black magic (i.e. potentially dangerous for the innocent user) and are thus disabled by default. ๐ฏ๏ธ if the Mail::SPF::BlackMagic Perl module is installed (module currently not available), they may be enabled by specifying --enable-black-magic.
--max-dns-interactive-termsn โ evaluate a maximum of n DNS-interactive mechanisms and modifiers per SPF check. defaults to10. do not override the default unless you know what you are doing!--max-name-lookups-per-termn โ perform a maximum of n DNS name look-ups per mechanism or modifier. defaults to10. do not override the default unless you know what you are doing!--authorize-mxes-foremail-address|domain,... โ consider all the MXes of the comma-separated list of email-addresses and domains as inherently authorized.--tfwlโ performtrusted-forwarder.orgaccreditation checking.--guessspf-terms โ use spf-terms as a default record if no SPF record is found.--localspf-terms โ process spf-terms as local policy before resorting to a default result (the implicit or explicitallmechanism at the end of the domain's SPF record). for example, this could be used for white-listing one's secondary MXes:mx:mydomain.example.org.--overridedomain=spf-record,--fallbackdomain=spf-record โ set overrides and fallbacks. each option can be specified multiple times. for example:
--override example.org='v=spf1 -all'
--override '*.example.net'='v=spf1 a mx -all'
--fallback example.com='v=spf1 -all'
๐ RESULT CODES ๐
passโ the specified IP address is an authorized SMTP sender for the identity. slay. โจfailโ the specified IP address is not an authorized SMTP sender for the identity.softfailโ the specified IP address is not an authorized SMTP sender for the identity, however the authority domain is still testing out its SPF policy.neutralโ the identity's authority domain makes no assertion about the status of the IP address.permerrorโ a permanent error occurred while evaluating the authority domain's policy (e.g., a syntax error in the SPF record). manual intervention is required from the authority domain.temperrorโ a temporary error occurred while evaluating the authority domain's policy (e.g., a DNS error). try again later.noneโ there is no applicable SPF policy for the identity domain.
๐ EXIT CODES ๐
like, this is the receipts, ok:
Result | Exit code
-----------+-----------
pass | 0
fail | 1
softfail | 2
neutral | 3
permerror | 4
temperror | 5
none | 6
๐ฅ EXAMPLES ๐ฅ
spfquery --scope mfrom --id user@example.com --ip 1.2.3.4
spfquery --file test_data
echo "127.0.0.1 user@example.com helohost.example.com" | spfquery -f -
๐ง COMPATIBILITY ๐ง
spfquery has undergone the following interface changes compared to earlier versions (character development, honestly):
2.500
- a new preferred usage style for performing individual SPF checks has been introduced. the new style accepts a unified
--identityoption and an optional--scopeoption that specifies the type (scope) of the identity. in contrast, the legacy usage style requires a separate usage form for every supported scope. see "Preferred usage" and "Legacy usage" for details. - the former
unknownanderrorresult codes have been renamed topermerrorandtemperror, respectively, in order to comply with RFC 4408 terminology. - SPF checks with an empty identity are no longer supported. in the case of an empty "MAIL FROM" SMTP transaction parameter, perform a check with the
heloscope directly. - the
--debugand--(no-)sanitizeoptions are currently ignored by this version ofspfquery. they will again be supported in the future. - several features that were supported by earlier versions of
spfqueryare considered black magic and thus are now disabled by default. see "Black Magic Options". - several option names have been deprecated. this is a list of them and their preferred synonyms:
Deprecated options | Preferred options
--------------------+-----------------------------
--sender, -s | --mfrom
--ipv4, -i | --ip-address, --ip
--name | --hostname
--max-lookup-count, | --max-dns-interactive-terms
--max-lookup |
--rcpt-to, -r | --authorize-mxes-for
--trusted | --tfwl
๐ฆ SEE ALSO ๐ฆ
Mail::SPF, spfd(8)
<http://tools.ietf.org/html/rfc4408>
๐ AUTHORS ๐
this version of spfquery is a complete rewrite by Julian Mehnle <julian@mehnle.net>, based on an earlier version written by Meng Weng Wong <mengwong+spf@pobox.com> and Wayne Schlitt <wayne@schlitt.net>.
and that's the whole page, bestie!! this one came fromperl v5.42.1, dated2026-04-23, and it's theSPFQUERY(1)manual ๐ go forth and verify those senders, periodt. ๐โจ
๐ฆ 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