Mailtrain - Open Source Software

Mailtrain Free Newsletter Software

On Premise Alternative to Mailchimp for Email Marketing

Improve customer engagement with targeted emails on promotions, updates and grow business by converting subscribers into customers using analytics tools.


Mailtrain is Mailchimp clone and feature-rich self-hosted newsletter software that is great for sending emails to millions of subscribers. Mailtrain provides superb features such as campaign automation with analytics.

Mailtrain lets you maintain very large lists and you may manually add subscribers, through the API or import them from a CSV file. All lists come with custom field support, and even combine tags. You can add different resources such as custom fields, including text fields, numbers, drop downs & checkboxes, via the merge tags. Just send messages to list subscribers that fit preset segmentation rules. You don’t need to create independent and small separated lists.

Mailtrain is built on Node.js, and MySQL/MariaDB. The license for this open source newsletter software is GPL-3.0 (GNU General Public License v3.0).

System Requirements

In order to install Mailtrain, you must have the following softwares:

  • Nginx
  • Node.js 7 or greater
  • MySQL v5.5 / MariaDB


  • Subscriber list management
  • List segmentation
  • Custom fields
  • Email templates
  • Large CSV list import files
  • RSS Campaigns
  • GPG Encryption
  • Statistics
  • Template Editors
  • Automation
  • Send via Multiple Providers


Install Mailtrain on Ubuntu 16.04 LTS using Github

Install Node.js and NPM

Install Node.js by using NodeSource APT repository.

curl -sL | sudo -E bash -
sudo apt install -y nodejs 

Check the Node.js and npm versions.

node -v && npm -v
# v8.11.1
# 5.6.0 

Install MySQL Server

Next, need to install database Server, use the following command to install MySql server

 sudo apt-get update;  sudo apt-get install mysql-server; mysql_secure_installation 

Once, the database server is installed, use the following command to restart MySql server

sudo systemctl restart mysql 

Create mailtrain database. Use following command to create database.


Create a database user called "" with new password. and granted user full access to the database by running the following commands. Change with your desired database user and with your desired password.

 CREATE USER ''@'localhost' IDENTIFIED BY ''; 

Install Nginx web server

Run below command to install Nginx.

sudo apt install nginx

Configure Nginx as reverse proxy. Run below command and add sample code in configuration file.

sudo nano /etc/nginx/sites-available/mailtrain.conf
server {

    listen [::]:80;
    listen 80;


    charset utf-8;
    client_max_body_size 50M;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_next_upstream error timeout http_502 http_503 http_504;


Create symlink for mailtrain.conf configuration file so Nginx can use it for application.

sudo ln -s /etc/nginx/sites-available/mailtrain.conf /etc/nginx/sites-enabled/

Restart Nginx web server.

sudo systemctl restart nginx

Install and Configure Mailtrain

Create directory for Mailtrain installation.

sudo mkdir -p /var/www/html/mailtrain

Navigate to the document root directory of Mailtrain.

cd /var/www/html/mailtrain

Download and unzip Mailtrain.

Run npm install

Copy config/default.toml as config/production.toml and update database settings.

sudo cp config/default.toml config/production.toml
sudo nano config/production.toml

Run the server.

NODE_ENV=production npm start

Congrats! You have successfully installed Mailtrain.


You may find the following links relevant: