![npm downloads](https://img.shields.io/npm/dt/authheaders.svg)
Node.js wrapper around the Python pip package authheaders exposing a function to generate Authentication-Results headers
Table of Contents
Requirements
-
Ensure that you have a Python version of >= 3.6 installed.
python3 --version
-
Install the package authheaders from our fork which contains a fix (until https://github.com/ValiMail/authentication-headers/pull/6 is merged and released):
pip3 install git+https://github.com/forwardemail/authentication-headers.git
-
Install dnspython v1.16.0:
pip3 install dnspython==1.16.0
-
Install pyspf:
pip3 install pyspf
Install
npm:
npm install authheaders
yarn:
yarn add authheaders
Usage
authenticateMessage
const fs = require('fs');
const { authenticateMessage } = require('authheaders');
const message = fs.readFileSync('/path/to/example.eml');
const selector = 'default';
const domain = 'example.com';
const srvId = 'mx.example.com';
const privateKeyFile = '/path/to/private.key';
authenticateMessage(message, selector, domain, privateKeyFile, srvId)
.then(console.log)
.catch(console.error);
(async () => {
try {
const result = await authenticateMessage(message, authservId, ip, mailFrom, helo);
console.log(result);
} catch (err) {
console.error(err);
}
})();
The value of result
is an String with the new Authentication-Results header to add to the top of the message headers.
Contributors
License
MIT © Nick Baugh