How to Install Mailtrain on Windows 11

Mailtrain is a self-hosted open-source email newsletter application that allows you to send trackable emails via your own self-hosted server. In this tutorial, we will guide you through the process of installing Mailtrain on your Windows 11 machine.

Prerequisites

Installation Steps

Step 1: Clone the Mailtrain Repository

Open Git Bash and navigate to the directory you want to install Mailtrain into. Run the following command to clone the Mailtrain repository:

git clone https://github.com/Mailtrain-org/mailtrain.git

Step 2: Install Dependencies

Navigate to the mailtrain directory and run the following command to install Mailtrain dependencies:

npm install

Step 3: Create Database and User

Open MySQL command line interface and create a new database and user with the following commands:

CREATE DATABASE mailtrain;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON mailtrain.* TO 'username'@'localhost';

Replace username and password with your desired values.

Step 4: Configure Mailtrain

Go to the mailtrain directory and create a copy of the .env.example file and name it .env.

cp .env.example .env

Open the .env file with a text editor and modify the following values:

DB_HOST=localhost
DB_USER=username
DB_PASSWORD=password
DB_NAME=mailtrain

Replace username and password with the values you set in Step 3.

By default, Mailtrain uses the SMTP server smtp.ethereal.email. If you want to use a different SMTP server, modify the following values in .env:

MAILER_HOST=smtp.example.com
MAILER_PORT=587
MAILER_SECURE=false
MAILER_USER=user@example.com
MAILER_PASS=password
MAILER_FROM=sender@example.com
MAILER_NAME=MyMailer

Replace smtp.example.com, user@example.com, password, sender@example.com, and MyMailer with your desired values.

Step 5: Run Mailtrain

Run the following command to start Mailtrain:

npm start

After a minute or so, you should see the message Server is listening on port 3000.

Step 6: Access Mailtrain

Open your web browser and go to http://localhost:3000. You should see the Mailtrain login page.

Use the default login credentials to log in:

Email: admin@example.com
Password: admin

Congratulations! You have successfully installed Mailtrain on your Windows 11 machine.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!