PHP bindings for libspf2 (https://libspf2.net)
Make sure you install libspf2 development package first.
$ git clone https://github.com/ppadron/php-spf
$ cd php-spf
$ phpize
$ ./configure
$ make
$ sudo make install
Load the extension. (check your PHP configuration files path)
$ echo "extension=spf.so" > /etc/php/conf.d/spf.ini
void Spf::__construct([int $type[, string $domain[, string $spf]]])
SpfResponse Spf::query(string $ip, string $helo, string $sender[, string $recipient])
Spf::TYPE_DNS_RESOLV- Use DNS resolver for SPF lookupsSpf::TYPE_DNS_CACHE- Use DNS cache for SPF lookups (default)Spf::TYPE_DNS_ZONE- Use DNS zone file for SPF lookups (requires domain and spf parameters)
string SpfResponse::getResult();
string SpfResponse::getHeaderComment();
string SpfResponse::getReceivedSpf();
string SpfResponse::getReceivedSpfValue();
string SpfResponse::getExplanation();
string SpfResponse::getSmtpComment();
boolean SpfResponse::hasErrors();
boolean SpfResponse::hasWarnings();
array SpfResponse::getErrors();
array SpfResponse::getWarnings();
SpfResponse::RESULT_INVALID- Invalid resultSpfResponse::RESULT_NEUTRAL- Neutral result (neither pass nor fail)SpfResponse::RESULT_PASS- SPF check passedSpfResponse::RESULT_FAIL- SPF check failedSpfResponse::RESULT_SOFTFAIL- SPF check soft-failedSpfResponse::RESULT_NONE- No SPF record foundSpfResponse::RESULT_TEMPERROR- Temporary error occurredSpfResponse::RESULT_PERMERROR- Permanent error occurred
SpfResponse::ERROR_NO_MEMORY- Out of memory errorSpfResponse::ERROR_NOT_SPF- Record is not an SPF recordSpfResponse::ERROR_SYNTAX- Syntax error in SPF recordSpfResponse::ERROR_MOD_W_PREF- Invalid modifier 'w' preferenceSpfResponse::ERROR_INVALID_CHAR- Invalid character in SPF recordSpfResponse::ERROR_UNKNOWN_MECH- Unknown mechanismSpfResponse::ERROR_INVALID_OPT- Invalid optionSpfResponse::ERROR_INVALID_CIDR- Invalid CIDR notationSpfResponse::ERROR_MISSING_OPT- Missing required optionSpfResponse::ERROR_INTERNAL_ERROR- Internal errorSpfResponse::ERROR_INVALID_ESC- Invalid escape sequenceSpfResponse::ERROR_INVALID_VAR- Invalid variableSpfResponse::ERROR_BIG_SUBDOM- Subdomain too largeSpfResponse::ERROR_INVALID_DELIM- Invalid delimiterSpfResponse::ERROR_BIG_STRING- String too largeSpfResponse::ERROR_BIG_MECH- Mechanism too largeSpfResponse::ERROR_BIG_MOD- Modifier too largeSpfResponse::ERROR_BIG_DNS- DNS record too largeSpfResponse::ERROR_INVALID_IP4- Invalid IPv4 addressSpfResponse::ERROR_INVALID_IP6- Invalid IPv6 addressSpfResponse::ERROR_INVALID_PREFIX- Invalid prefix lengthSpfResponse::ERROR_RESULT_UNKNOWN- Unknown resultSpfResponse::ERROR_UNINIT_VAR- Uninitialized variableSpfResponse::ERROR_MOD_NOT_FOUND- Modifier not foundSpfResponse::ERROR_NOT_CONFIG- Not configuredSpfResponse::ERROR_DNS_ERROR- DNS lookup errorSpfResponse::ERROR_BAD_HOST_IP- Bad host IP addressSpfResponse::ERROR_BAD_HOST_TLD- Bad host TLDSpfResponse::ERROR_MECH_AFTER_ALL- Mechanism found after 'all'SpfResponse::ERROR_INCLUDE_RETURNED_NONE- Include returned 'none'SpfResponse::ERROR_RECURSIVE- Recursive include detectedSpfResponse::ERROR_MULTIPLE_RECORDS- Multiple SPF records found