Coder Social home page Coder Social logo

forwardemail / python-spfcheck2 Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 3.0 368 KB

Node.js wrapper around Python's spf.check2 function which conforms to both RFC4408 and RFC7208

Home Page: https://forwardemail.net

License: MIT License

JavaScript 75.21% Python 24.79%
spf rfc4408 rfc7208 email forwarding python node wrapper check2 check validate validation validator mail

python-spfcheck2's Introduction

python-spfcheck2

build status code coverage code style styled with prettier made with lass license npm downloads

Node.js wrapper around Python's spf.check2 function which conforms to both RFC4408 and RFC7208

Table of Contents

Requirements

  1. 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
  2. Install the packages pyspf and dnspython:

    pip3 install pyspf
    pip3 install dnspython

Install

npm:

npm install python-spfcheck2

yarn:

yarn add python-spfcheck2

Usage

const spfCheck2 = require('python-spfcheck2');

const ip = '69.55.226.139';
const address = '[email protected]';
const host = 'mx1.wayforward.net';

// then/catch usage
spfCheck2(ip, address, host)
  .then([result, explanation] => console.log(result, explanation))
  .catch(console.error);

// async/await usage
(async () => {
  try {
    const [ result, explanation ] = await spfCheck2(ip, address, host);
    console.log(result, explanation);
  } catch (err) {
    console.error(err);
  }
})();

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/

License

MIT © Nick Baugh

python-spfcheck2's People

Contributors

niftylettuce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.