6 KiB
Mailtrain
Mailtrain is a self hosted newsletter application built on Node.js (v10+) and MySQL (v8+) or MariaDB (v10+).
Features
- Subscriber lists management
- List segmentation
- Custom fields
- Email templates (including MJML-based templates)
- Custom reports
- Automation (triggered and RSS campaigns)
- Multiple users with granular user permissions and flexible sharing
- Hierarchical namespaces for enterprise-level situations
Hardware Requirements
- 1 vCPU
- 2048 MB RAM
Quick Start
Preparation
Mailtrain creates three URL endpoints, which are referred to as "trusted", "sandbox" and "public". This allows Mailtrain to guarantee security and avoid XSS attacks in the multi-user settings. The function of these three endpoints is as follows:
- trusted - This is the main endpoint for the UI that a logged-in user uses to manage lists, send campaigns, etc.
- sandbox - This is an endpoint not directly visible to a user. It is used to host WYSIWYG template editors.
- public - This is an endpoint for subscribers. It is used to host subscription management forms, files and archive.
The recommended deployment of Mailtrain would use 3 DNS entries that all points to the same IP address. For example as follows:
- lists.example.com - public endpoint (A record
lists
underexample.com
domain) - mailtrain.example.com - trusted endpoint (CNAME record
mailtrain
underexample.com
domain that points tolists
) - sbox.mailtrain.example.com - sandbox endpoint (CNAME record
sbox.mailtrain
underexample.com
domain that points tolists
)
Installation on fresh CentOS 7 (public website secured by SSL)
This will setup a publicly accessible Mailtrain instance. All endpoints (trusted, sandbox, public) will provide both HTTP (on port 80) and HTTPS (on port 443). The HTTP ports just issue HTTP redirect to their HTTPS counterparts.
The script below will also acquire a valid certificate from Let's Encrypt. If you are hosting Mailtrain on AWS or some other cloud provider, make sure that before running the installation script you allow inbound connection to ports 80 (HTTP) and 443 (HTTPS).
Note, that this will automatically accept the Let's Encrypt's Terms of Service. Thus, by running this script below, you agree with the Let's Encrypt's Terms of Service (https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf).
-
Login as root. (I had some problems running npm as root on CentOS 7 on AWS. This seems to be fixed by the seemingly extraneous
su
withinsudo
.)sudo su -
-
Install git
yum install -y git
-
Download Mailtrain using git to the
/opt/mailtrain
directorycd /opt git clone https://github.com/Mailtrain-org/mailtrain.git cd mailtrain git checkout development
-
Run the installation script. Replace the urls and your email address with the correct values. NOTE that running this script you agree Let's Encrypt's conditions.
sh setup/install-centos7-https.sh mailtrain.example.com sbox.mailtrain.example.com lists.example.com admin@example.com
-
Start Mailtrain and enable to be started by default when your server starts.
systemctl start mailtrain systemctl enable mailtrain
-
Open the trusted endpoint (like
https://mailtrain.example.com
) -
Authenticate as
admin
:test
-
Update your password under admin/Account
-
Update your settings under Administration/Global Settings.
-
If you intend to sign your email by DKIM, set the DKIM key and DKIM selector under Administration/Send Configurations.
Installation on fresh CentOS 7 (local installation)
This will setup a locally accessible Mailtrain instance (primarily for development and testing). All endpoints (trusted, sandbox, public) will provide only HTTP as follows:
- http://localhost:3000 - trusted endpoint
- http://localhost:3003 - sandbox endpoint
- http://localhost:3004 - public endpoint
-
Login as root. (I had some problems running npm as root on CentOS 7 on AWS. This seems to be fixed by the seemingly extraneous
su
withinsudo
.)sudo su -
-
Install git
yum install -y git
-
Download Mailtrain using git to the
/opt/mailtrain
directorycd /opt git clone https://github.com/Mailtrain-org/mailtrain.git cd mailtrain git checkout development
-
Run the installation script. Replace the urls and your email address with the correct values. NOTE that running this script you agree Let's Encrypt's conditions.
sh setup/install-centos7-local.sh
-
Start Mailtrain and enable to be started by default when your server starts.
systemctl start mailtrain systemctl enable mailtrain
-
Open the trusted endpoint http://localhost:3000
-
Authenticate as
admin
:test
Quick Start - Deploy with Docker
Requirements:
Steps:
Depending on how you have configured your system and Docker you may need to prepend the commands below with sudo
.
- Download Mailtrain files using git:
git clone git://github.com/Mailtrain-org/mailtrain.git
(or download zipped repo) and open Mailtrain foldercd mailtrain
- Copy the file
docker-compose.override.yml.tmpl
todocker-compose.override.yml
and modify it if you need to. - Bring up the stack with:
docker-compose up -d
- Start:
docker-compose start
- Open http://localhost:3000/ (change the host name
localhost
to the name of the host where you are deploying the system). - Authenticate as user
admin
with passwordtest
- Navigate to http://localhost:3000/settings and update service configuration.
- Navigate to http://localhost:3000/users/account and update user information and password.
License
GPL-V3.0