https://github.com/forwardemail/python-spfcheck2
Node.js wrapper around Python's spf.check2 function which conforms to both RFC4408 and RFC7208
https://github.com/forwardemail/python-spfcheck2
check check2 email forwarding mail node python rfc4408 rfc7208 spf validate validation validator wrapper
Last synced: 9 months ago
JSON representation
Node.js wrapper around Python's spf.check2 function which conforms to both RFC4408 and RFC7208
- Host: GitHub
- URL: https://github.com/forwardemail/python-spfcheck2
- Owner: forwardemail
- License: mit
- Created: 2019-03-05T18:26:14.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-14T05:46:49.000Z (10 months ago)
- Last Synced: 2025-04-20T16:12:28.572Z (9 months ago)
- Topics: check, check2, email, forwarding, mail, node, python, rfc4408, rfc7208, spf, validate, validation, validator, wrapper
- Language: JavaScript
- Homepage: https://forwardemail.net
- Size: 489 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-spfcheck2
[](https://travis-ci.com/niftylettuce/python-spfcheck2)
[](https://codecov.io/gh/niftylettuce/python-spfcheck2)
[](https://github.com/sindresorhus/xo)
[](https://github.com/prettier/prettier)
[](https://lass.js.org)
[](LICENSE)
[](https://npm.im/python-spfcheck2)
> Node.js wrapper around Python's spf.check2 function which conforms to both RFC4408 and RFC7208
## Table of Contents
* [Requirements](#requirements)
* [Install](#install)
* [Usage](#usage)
* [Contributors](#contributors)
* [License](#license)
## 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):
```sh
python3 --version
```
2. Install the packages [pyspf][] and `dnspython`:
```sh
pip3 install pyspf
pip3 install dnspython
```
## Install
[npm][]:
```sh
npm install python-spfcheck2
```
[yarn][]:
```sh
yarn add python-spfcheck2
```
## Usage
```js
const spfCheck2 = require('python-spfcheck2');
const ip = '69.55.226.139';
const address = 'terry@wayforward.net';
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** | |
## License
[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)
##
[npm]: https://www.npmjs.com/
[yarn]: https://yarnpkg.com/
[pyspf]: https://pypi.org/project/pyspf/