How to Setup SMTP & Install MailWizz Email Marketing System

What is MailWizz?

MailWizz is an email marketing automation system that allows users to build their own email marketing systems. It is a self-hosted solution, which means that it consists of two parts: the sender (SMTP service) and the management application. The management application is where users can configure and manage their email lists, marketing campaigns, and analyze results, among other things. MailWizz is a one-time payment PHP script that can be purchased from here.

What do we mean by a self-hosted email marketing solution?

A self-hosted email marketing solution refers to an email marketing system that is hosted on the user’s own server, rather than on a third-party server. This means that the user has complete control over their email marketing system and can customize it to their specific needs. A self-hosted email marketing solution typically consists of two parts: the sender (SMTP service) and the management application. The sender is responsible for sending emails over the internet, while the management application is where users can configure and manage their email lists, marketing campaigns, and analyze results, among other things.

What are the requirements to setup MailWizz?

To set up MailWizz, you must need to have the following things:

  • A domain name: This is the URL that you will use to access the MailWizz system(Namecheap Recommended).
  • A VPS (Virtual Private Server): This is the server where you will host, install and run the MailWizz system(Vultr Recommended).
  • A MySQL database: This is where MailWizz will store all of its data, such as email lists and campaign information.
  • Apache, PHP, and MySQL: These are required to host any PHP application like MailWizz on your server.
  • An FTP client: This is used to upload the MailWizz installation package to your web hosting account.
  • The MailWizz installation package: This can be downloaded from here.

Once you have these things, you can begin the process of setting up and installing MailWizz.

How to connect domain with VPS?

To connect a domain with a VPS (Virtual Private Server), you will need to point the domain to the VPS’ IP address. Here’s how to do it:

  • First, find the IP address of your VPS. This can usually be found in the control panel or dashboard provided by your VPS hosting company.
  • Next, go to the domain registrar where you purchased your domain. This could be a company like GoDaddy, Namecheap, or others.
  • Sign in to your account and find the “DNS Management” or “Name Server Management” section.
  • Find the option to change the name servers for your domain. You will need to enter the name servers provided by your VPS hosting company. These can usually be found in the control panel or dashboard for your VPS.
  • Save your changes and wait for the DNS changes to propagate. This can take anywhere from a few hours to a couple of days.

Once the DNS changes have propagated, your domain should be connected to your VPS. You can test this by visiting the domain in a web browser and seeing if it loads the website hosted on your VPS.

How to connect VPS server using any SSH client like putty?

  • Download and install PuTTY on your computer.
  • Open PuTTY and enter the IP address or hostname of your VPS in the “Host Name” field.
  • In the “Category” menu on the left, go to “Connection > SSH > Auth”.
  • Click the “Browse” button and select the private key file that was provided to you by your VPS hosting company. This is usually a .ppk file.
  • In the “Category” menu on the left, go to “Session”.
  • Enter a name for this connection in the “Saved Sessions” field and click the “Save” button.
  • Click the “Open” button to open the connection to your VPS.
  • When prompted, enter the username and password for your VPS. You should now be connected to your VPS via SSH.

Install Apache, PHP, and MySQL which are the prerequisites for hosting any PHP application like MailWizz

*Note: In DigitalOcean or some other providers, you can get a server with all prerequisites installed, if this is your case, you can skip all this installation and go directly to creating a MySQL Database section.

Step 1: Install Apache2 Web Server on Ubuntu
Run the commands below to Install Apache Web Server on Our VPS Server.

sudo apt update sudo apt install apache2

Just wait a few seconds for the installation to finish, then run the following commands to test and enable the Apache service.

sudo systemctl restart apache2.service sudo systemctl enable apache2.service

To test if Apache is working on your Server, open any web browser and browse to the VPS IP address (http://YOUR_SERVER_IP).

You should see the Apache default page like this:

Step 2: Install MariaDB (MySQL) Database Server
MailWizz is like any other PHP System that requires a Database to save data. So we will use the MariaDB Mysql Database system for this purpose.

To install MariaDB run the commands below:

sudo apt-get install mariadb-server mariadb-client

The commands below can be used to stop, start and enable MariaDB MySQL service to always start up when the server boots.

Run these on Ubuntu 20.04 LTS

sudo systemctl stop mysql.service sudo systemctl start mysql.service sudo systemctl enable mysql.service

Run these on Ubuntu 18.04 and 18.10 LTS

sudo systemctl stop mariadb.service sudo systemctl start mariadb.service sudo systemctl enable mariadb.service

After that, run the commands below to secure the MariaDB server by creating a root password and disallowing remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

Enter current password for root (enter for none): Just press the Enter
Set a root password? [Y/n]: Y
New password: Enter your new password (create a secure one)
Re-enter new password: Repeat your new password
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]: Y
Reload privilege tables now? [Y/n]: Y
Restart MariaDB Mysql service

To test if MariaDB is installed, type the commands below to logon to MariaDB server

sudo mysql -u root -p

Then type the password you created above to sign on… if successful, you should see MariaDB welcome message like this:

MariaDB Installed Successfully

Step 3: Install PHP and Related Modules
Since MailWizz is a PHP based script, we need to install PHP and some modules on our server. I will be installing PHP 7.4 in this guide, but feel free to use any version you want, just change “7.4” to “7.X” in the commands.

sudo apt install php7.4 libapache2-mod-php7.4 php7.4-common php7.4-gmp php7.4-curl php4.1-intl php7.4-mbstring php7.4-xmlrpc php7.4-mysql php7.4-bcmath php7.4-gd php7.4-xml php7.4-cli php7.4-zip php7.4-imap

After installing PHP 7.4, Open WinSCP to edit the php.ini file.

WinSCP is a free, open-source file transfer program that allows users to transfer files between a local and a remote computer. It supports a variety of file transfer protocols, including FTP, SFTP, and SCP.

Open WinSCP and connect to your server using your server IP/Name and root credentials. Then navigate this directory: “/etc/php/7.X/apache2/” where you can find the “php.ini” configuration file.

Right-click on “php.ini” and Click Edit.

Then make the changes on the following lines below in the file and save.

file_uploads = On allow_url_fopen = On short_open_tag = On memory_limit = 256M
max_execution_time = 360 date.timezone = Asia/Kolkata

After applying the changes above, save the file and Close. then Go to Putty again and restart apache service:

sudo systemctl restart apache2.service

Step 4: Create MailWizz Database
Now, we are done installing all the prerequisites and our server is ready for the installation, we need to create a Database for MailWizz in MariaDB.

To login to the MariaDB MySql database server, run the commands below.

sudo mysql -u root -p

Then create a database called Mailwizz

CREATE DATABASE mailwizz;

Create a database user called MailWizz with a new password

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

Then grant the user full access to the database.

GRANT ALL ON mailwizz.* TO 'mailwizz'@'localhost' IDENTIFIED BY 'Your_Password_Here' WITH GRANT OPTION;

Finally, save your changes and exit.

FLUSH PRIVILEGES; EXIT;

Step 5: Setup Mailwizz

Now we are ready, you just need to upload the Mailwizz Latest Folder to the server and run the installation. So follow up the following simple steps:

1- Zip The Mailwizz “ latest” Folder that you will find when you download Mailwizz.

2- Upload “latest.zip to our server” in /var/www/html using WinSCP

3- Connect to your server using Putty SSH client.

4- Change Directory to /var/www/html using the following command:

cd /var/www/html

5- Install the unzip tool using the following command, this will be used to unzip the “latest” folder

sudo apt-get install unzip

6- Clear putty screen to make it clean using the following command:

clear

7- Unzip the “latest.zip” file using the following command:

unzip latest.zip

8- Using WinSCP, Move the latest folder content to the upper directory so it can be accessed directly. ( Just Drag and Drop using WinSCP )

Then delete the html folder, and rename “latest” to html.

In this way, the Mailwizz files are in the html folder directly.

9- Start Mailwizz Installation by opening your web browser and opening the URL: yourdomain.com/install

Configure Mailwizz

Now, Enter your purchase code, Agree on the terms and click Next.

Install PHP extensions required by Mailwizz

If you see any PHP extensions labeled in red or yellow (check image below), then you need to install it before you continue:

Simply run the following commands:

sudo apt install php7.4-xml
sudo apt install php7.4-mbstring
sudo apt install php7.4-curl
sudo apt install php7.4-zip
sudo apt install php7.4-imap

Note: Don’t forget to replace 7.4 with your PHP active version

Then Restart apache service using the following command:

sudo service apache2 restart

Now, click next, and Mailwizz installation will check for folder permissions, if you see any warning, then Open WinSCP and set the permission for each folder listed to 777.

You can also use Putty to set permissions with the chmod command:

sudo chmod -R 777 /directory_path

After you set all permissions, refresh the page and check if everything is OK, then click Next.

In the Next Page Enter your Database info. in our case:

Hostname: localhost
Port: 3306
Username: mailwizz
Password: Enter Your DB Password
Database name: mailwizz

Click Next and Create Your Admin Account.

Setup Cron Jobs

Congratulations! Now we finished the Installation process and MailWizz is up and running. we only need to set up the Cron jobs.

What are Cron Jobs?

Cron jobs are tasks that are scheduled to run automatically at a specific time or interval. They are often used to automate system maintenance or administration, such as backing up databases, sending emails, or updating software.

In the context of a web server, cron jobs are typically set up using a command-line utility called “cron”. The administrator can specify when and how often the cron job should run by creating a crontab file that specifies the schedule and command to be executed.

For example, to run a backup script every day at midnight, the administrator could create a crontab file that looks like this:

0 0 * * * /path/to/backup.sh

This would run the backup.sh script every day at midnight (12:00 AM). The syntax for specifying the schedule follows a specific format, with the six fields representing:

Minute (0-59)
Hour (0-23)
Day of the month (1-31)
Month (1-12)
Day of the week (0-6, with 0 being Sunday)
Command to execute
Cron jobs can be very useful for automating tasks and freeing up time for other activities, but they can also cause problems if not configured properly. It is important to test and verify that cron jobs are running correctly before relying on them for critical tasks.

Where to paste cron jobs?

Open WinSCP, and in the “/etc” directory you will find the “crontab” file. Edit it, and paste the jobs inside, then save.

Important Note: when you paste the jobs add “root” to the commands so the jobs car run as root user on your VPS. Example:

* * * * root /usr/bin/php -q /var/www/html/apps/console/console.php send-campaigns >/dev/null 2>&1

Do this for all in a same way and save the file.

Install SSL Certificate

SSL certificates are an important part of maintaining the security and privacy of online communication. It is important to use SSL certificates on any website that handles sensitive information. Let’s Encrypt is a free, open-source certificate authority (CA) that provides SSL/TLS (Secure Sockets Layer/Transport Layer Security) certificates to enable secure connections between a client and a server over the internet.

Connect to your Server using Putty SSH client.

Step 1 — Install the Let’s Encrypt Client
Let’s Encrypt certificates are fetched via client software running on your server. The official client is called Certbot.

First, add the repository to install Certbot:

sudo add-apt-repository ppa:certbot/certbot

and press ENTER to accept.

Then, Update the package list to pick up the new repository’s package information:

sudo apt-get update

Install Certbot’s Apache package:

sudo apt install python-certbot-apache

Certbot is now ready to be used.

Step 2 — Set Up the SSL Certificate
The client will automatically obtain and install a new SSL certificate that is valid for the domains provided as parameters.

You just simply need to run the following command: (change the domain)

sudo certbot --apache -d yourdomain.com

You will be asked to provide an email address for lost key recovery and notices, and you will be able to choose between enabling both http and https access or forcing all requests to redirect to https. It is usually safest to require https, unless you have a specific need for unencrypted http traffic.

 

About the author

Technical Sahil

Sahil Dhamija is a visionary entrepreneur and tech enthusiast, proudly owning multiple companies across India, the US, the UK, and the UAE. As the founder of AInventions Technologies LLC, DigitalMarkethink Solutions LLC, WebReinvent Technologies LLC, BusinessMate Software Solutions LLC, and co-founder of Hostyaga FZE LLC, Sahil is a dynamic leader shaping the future of technology and digital marketing.

Apart from leading his businesses, Sahil is a passionate tech YouTuber, sharing insights and tutorials on various technological topics. He also serves as the CTO at Vayuna Corporate Travels Pvt Ltd and as Product Head at Vayuna Voicetech Pvt Ltd, where he oversees cutting-edge solutions in corporate travel and voice technology. Additionally, Sahil is a creative force in the film industry, producing films through Gentle Breeze Films Pvt Ltd.

Driven by innovation and creativity, Sahil continues to push boundaries in technology, media, and business.

View all posts

5 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *