python-spfcheck2
Node.js wrapper around Python's spf.check2 function which conforms to both RFC4408 and RFC7208
Table of Contents
Requirements
-
Ensure that you have a Python version of >= 3.5 installed per pyspf requirements (note that Python v3 is required because of a bug with DNS recursive CNAME lookups on v2.7):
python3 --version -
Install the packages pyspf and
dnspython
:pip3 install pyspfpip3 install dnspython
Install
npm:
npm install python-spfcheck2
yarn:
yarn add python-spfcheck2
Usage
const spfCheck2 = ; const ip = '69.55.226.139';const address = 'terry@wayforward.net';const host = 'mx1.wayforward.net'; // then/catch usage ; // async/await usageasync { try const result explanation = await ; console; catch err console; };
Note that result
is a String (which also corresponds to a particular explanation
), see table below for the full list:
Result | Explanation |
---|---|
pass |
sender SPF authorized |
fail |
SPF fail - not authorized |
neutral |
permanent error in processing |
softfail |
domain owner discourages use of this host |
permerror |
permanent error in processing |
temperror |
temporary DNS error in processing |
none |
|
local |
No SPF result due to local policy |
trusted |
No SPF check - trusted-forwarder.org |
ambiguous |
No error, but results may vary |
An error is thrown if the child process itself (spf.check2
) errors.
Contributors
Name | Website |
---|---|
Nick Baugh | http://niftylettuce.com/ |