No description
Find a file
2016-06-10 11:23:56 +03:00
config Added node for MAMP users 2016-06-02 09:37:23 -04:00
lib Do not delete url pointers from database when resetting campaign 2016-06-09 09:53:38 +03:00
public Added support for relative date ranges in segments 2016-06-01 16:36:24 +03:00
routes Do not delete url pointers from database when resetting campaign 2016-06-09 09:53:38 +03:00
services v1.10.1 2016-05-26 12:53:12 +03:00
setup Update install.sh 2016-06-02 15:08:32 +03:00
test Initial import 2016-04-04 15:36:30 +03:00
views removed campaign link 2016-06-10 11:23:56 +03:00
.eslintrc.js Initial import 2016-04-04 15:36:30 +03:00
.gitignore Added VERP support 2016-04-10 20:26:20 -07:00
app.js Added support for relative date ranges in segments 2016-06-01 16:36:24 +03:00
CHANGELOG.txt v1.11.0 2016-05-31 17:32:36 +03:00
Gruntfile.js Initial import 2016-04-04 15:36:30 +03:00
index.js Added support for relative date ranges in segments 2016-06-01 16:36:24 +03:00
LICENSE Added CLA file 2016-05-13 11:45:18 +03:00
meta.json v1.11.0 2016-05-31 17:32:36 +03:00
nitrous-post-create.sh Display failed imported addresses 2016-04-25 15:39:17 +03:00
nitrous.json Add nitrous.io Quickstart configs and update README 2016-04-12 09:14:02 +00:00
package.json Do not delete url pointers from database when resetting campaign 2016-06-09 09:53:38 +03:00
README.md Update README.md 2016-06-02 15:08:04 +03:00
README.nitrous.md Add nitrous.io Quickstart configs and update README 2016-04-12 09:14:02 +00:00

Mailtrain

Mailtrain is a self hosted newsletter application built on Node.js (v5+) and MySQL (v5.5+ or MariaDB).

NB! I'm running an IndieGoGo campaign to help fund developing first class automation support into Mailtrain. See all details here: https://igg.me/at/mailtrain/8720095

Features

Mailtrain supports subscriber list management, list segmentation, custom fields, email templates, large CSV list import files, etc.

Subscribe to Mailtrain Newsletter here (uses Mailtrain obviously)

Cons

  • Alpha-grade software. Might or might not work as expected
  • Awful code base, needs refactoring
  • No tests
  • Almost no documentation (there are some guides in the Wiki)

Requirements

  • Nodejs v5+
  • MySQL v5.5 or MariaDB
  • Redis (optional, disabled by default, used only for session storage)

Installation

Automatic install (Ubuntu)

You can download and run install.sh in your blank Ubuntu VPS to set up Mailtrain and all required dependencies (including MySQL). The installation script assumes a somewhat blank server, so if this is a machine you are already using for something else, you might want to skip the automatic install and proceed manually.

If you like living on the edge and feel adventurous you can run the installation script directly from your command line as root:

curl https://raw.githubusercontent.com/andris9/mailtrain/master/setup/install.sh | sudo bash

Install script installs and sets up the following:

  • Node.js (version 6.x)
  • MySQL (platform default)
  • Mailtrain (from the master branch) on port 80
  • UFW firewall that blocks everything besides ports 22, 25, 80, 443
  • Redis server for session cache
  • logrotate to rotate Mailtrain log files
  • upstart or systemd init script to automatically start and manage Mailtrain process

If you are using DigitalOcean then you can copy the contents of the installation script to the User Data textarea field when creating a new VPS (select Ubuntu 14.04 as the droplet Distribution image). After your droplet is created it should already have Mailtrain up and running. Navigate to http://droplet-hostname-or-ip/ and authenticate as admin:test. Do not forget to update your account information and set up SMTP settings.

Manual (any OS that supports Node.js)

  1. Download Mailtrain files using git: git clone git://github.com/andris9/mailtrain.git (or download zipped repo) and open Mailtrain folder cd mailtrain
  2. Run npm install --production in the Mailtrain folder to install required dependencies
  3. Copy config/default.toml as config/production.toml and update MySQL and any other settings in it
  4. Run the server NODE_ENV=production npm start
  5. Open http://localhost:3000/
  6. Authenticate as admin:test
  7. Navigate to http://localhost:3000/settings and update service configuration
  8. Navigate to http://localhost:3000/users/account and update user information and password

Upgrade

  • Replace old files with new ones by running in the Mailtrain folder git pull origin master if you used Git to set Mailtrain up or just download new files and replace old ones with these
  • Run npm install --production in the Mailtrain folder

Using environment variables

Some servers expose custom port and hostname options through environment variables. To support these, create a new configuration file config/local.js:

module.exports = {
    www: {
        port: process.env.OPENSHIFT_NODEJS_PORT,
        host: process.env.OPENSHIFT_NODEJS_IP
    }
};

Mailtrain uses node-config for configuration management and thus the config files are loaded in the following order:

  1. default.toml
  2. {NODE_ENV}.toml (eg. development.toml or production.toml)
  3. local.js

Running behind Nginx proxy

Edit mailtrain.nginx (update server_name directive) and copy it to /etc/nginx/sites-enabled

Running as an Upstart service in Ubuntu 14.04

Edit mailtrain.conf (update application folder) and copy it to /etc/init

Nitrous Quickstart

You can quickly create a free development environment for this Mailtrain project in the cloud on www.nitrous.io:

Nitrous Quickstart

In the IDE, start Mailtrain via Run > Start Mailtrain and access your site via Preview > 3000.

Bounce handling

Mailtrain uses webhooks integration to detect bounces and spam complaints. Currently supported webhooks are:

  • AWS SES create a SNS topic for complaints and bounces and use http://domain/webhooks/aws as the subscriber URL for these topics
  • SparkPost use http://domain/webhooks/sparkpost as the webhook URL for bounces and complaints (instructions)
  • SendGrid use http://domain/webhooks/sendgrid as the webhook URL for bounces and complaints (instructions)
  • Mailgun use http://domain/webhooks/mailgun as the webhook URL for bounces and complaints (instructions)

Additionally Mailtrain (v1.1+) is able to use VERP-based bounce handling. This would require to have a compatible SMTP relay (the services mentioned above strip out or block VERP addresses in the SMTP envelope) and you also need to set up special MX DNS name that points to your Mailtrain installation server.

Testing

There is a built in /dev/null server in Mailtrain that you can use to load test your installation. Check the [testserver] section in the configuration file for details. By default the test server is disabled. The server uses only cleartext connections, so select "Do not use encryption" in the encryption settings when setting up the server data in Mailtrain.

Additionally you can generate CSV import files with fake subscriber data:

node setup/fakedata.js > somefile.csv

This command generates a CSV file with 100 000 subscriber accounts

License

GPL-V3.0