Mailtrain is a free and open-source self-hosted email newsletter application that lets you easily manage and send newsletters to your subscribers. In this tutorial, we will guide you through the installation and setup of Mailtrain on Debian Latest.
Before installing any application, it is always recommended to update the system to the latest version. To do this, run the following command:
sudo apt update && sudo apt upgrade
Mailtrain is built on top of Node.js, so we need to install Node.js first. We will be using the Node.js package provided by the NodeSource repository, which is more up-to-date than the version in the Debian repository.
To add the NodeSource repository, run the following commands:
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
Verify that Node.js is installed by checking the version:
node --version
Now, we can install Mailtrain by downloading its source code from the official Mailtrain repository on GitHub.
Clone the Mailtrain repository using the following command:
git clone https://github.com/Mailtrain-org/mailtrain.git
The above command will clone the latest release. To clone a specific version, use the following command instead:
git clone -b vX.X.X https://github.com/Mailtrain-org/mailtrain.git
Replace "X.X.X" with the version you want to install.
Once the repository has been cloned, navigate into the Mailtrain directory:
cd mailtrain
Then, install Mailtrain's dependencies:
npm install --production
This will take a few minutes to complete.
After installing the dependencies, you need to configure Mailtrain with your email server details and database details.
Copy the default configuration file:
cp config/config-defaults.js config/config.js
Edit the config.js file:
nano config/config.js
In this file, modify the following values according to your needs:
config.web.baseUrl = 'http://YOUR_SERVER_IP:3000'; // Replace YOUR_SERVER_IP with your server's IP address or domain name
config.emails.transport = 'SMTP';
config.emails.smtp.host = 'smtp.gmail.com'; // Replace with your email server host
config.emails.smtp.port = 587;
config.emails.smtp.auth.user = 'your-name@gmail.com'; // Replace with your email address
config.emails.smtp.auth.pass = 'your-email-password'; // Replace with your email password
config.database = {
type: 'mysql',
host: 'localhost',
port: 3306,
user: 'mailtrain', // Replace with your database username
password: 'password', // Replace with your database password
database: 'mailtrain'
};
To save and exit the editor, press "Ctrl+O", then "Ctrl+X".
Once you have configured Mailtrain, start Mailtrain using the following command:
npm start
By default, Mailtrain will start listening on port 3000.
To access Mailtrain from your web browser, navigate to:
http://YOUR_SERVER_IP:3000
Replace YOUR_SERVER_IP with your server's IP address or domain name.
You should see the Mailtrain login screen. Sign in with the username "admin" and the password "test".
Congratulations! You have successfully installed Mailtrain on Debian Latest. You can now use Mailtrain to manage and send newsletters to your subscribers.
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!