/haraka-mail-forwarding-plugin

Haraka Mail Forwarding Plugin

Primary LanguageJavaScript

Haraka Mail Forwarding Plugin

Build status

About

This is a plugin which should be run and configured with the Haraka SMTP server.

Based off of the original haraka-alias-forward by chadsmith on Github. Work on this version began from a fork of X-Ryl669's modifications to the original source. X-Ryl669's modifications implements SRS rewrites which leads to a noticable improvement in email delivery.

This plugin interfaces with MongoDB.

This allows us to do two important things:

  • update aliases and forwarding rules on the fly
  • store Message-ID and Reference headers to allow the masking of email replies

See plugins/mail_forwarding.js.

Set Up

Prequisites

Installation

Run yarn in the main directory to install necessary packages. Haraka can be run by running haraka -c /path/to/this/repository

Configuration

Haraka's documentation provides a very thorough coverage of configuration options. I recommend properly configuring DKIM SPF, and DMARC on the domain that will be forwarding emails to avoid emails from landing in spam. I also recommend setting up the tls plugin. I have included some of these configuration files in this repository.

Please do not forget to change the secret and sender_domain values in config/srs.ini.

An .env file should be kept in your main Haraka folder with the following keys: MONGO_URI and MONGO_DB_NAME. If these two values are not set on either the .env file or in the environment that this instance of Haraka is running, this plugin will throw an error.

Tests

To run tests, run yarn test. These tests were written using the Sinon and assert libraries and can be found in the tests directory.