What is MailWizz?
Mailwizz is a self-hosted email marketing automation system used in building your own Email Marketing Systems.
Where to get Mailwizz?
What do we mean by a self-hosted email marketing solution?
As I explained in my Email Marketing Definitive Technical Guide,
any Email marketing system consists of two parts:
- The sender: (SMTP service) this is the technical part. It allows you to send emails over the internet.
- The Management Application, where you can configure and manage your Email Lists, Marketing Campaigns, monitor and analyze results, manage your sending servers, and so on.
So we connect both together to get an Email Marketing System.
In our case, The Management Application will be MailWizz.
In this Guide, I will show you How to setup and configure MailWizz step by step from getting a server, till running and configuring your first campaign.
What is required to Setup MailWizz?
What you need is simply is:
- A VPS Server to install MailWizz on.
- Domain Name to use with our setup.
Get a Domain Name.
Getting a Domain is as simple as eating a piece of chocolate cake. you need to go to any Domain registrar company like Godaddy, Enom, Freenom, Namecheap…. and Buy a Domain Name, you can even get one for 1$ per year.
I do recommend to get a .com domain that reflects your business. and if you already have one, as I think so, you can just skip this, and continue to get a VPS Server.
Watch this 3 Minutes Video and see how to get and buy a domain name from Godaddy:
Get a VPS Server.
Now, Let’s get our VPS server to set up MailWizz on.
What company should I use?
You can use whatever company you want to buy a VPS Server, in this guide I will be using Digital Ocean Cloud services.
Feel free to use any VPS company you want, It's up to you!
You can also sign up on DigitalOcean through the coupon link below to get free 100$ to test everything free.
So after you signup on Digital Ocean or any other VPS company, just create a Server with the following specifications:
- Ubuntu 16/18 x64 as your operating system.
- You can start with 1 CPU/ 1 GB RAM (You can resize later).
Point Domain to VPS.
Before we continue you need to point your domain or subdomain to your VPS IP address.
OK so now we have a Domain and a VPS server, Let's Start the installation.
Connect to your VPS server using any SSH client like putty.
And Lets Install Apache, PHP, and MySQL which are the pre requests for hosting any PHP application like MailWizz.
*Note: In Digital Ocean 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 (part 4).
Here I'm trying to show everything so the Guide can cover any scenario.
Take a look at this video to see how I got a prebuild LAMP Droplet from Digital Ocean:
Now, I will go back and show you how to start from scratch if you have a clean Ubuntu installation and go manually with each step.
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 16.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.
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:
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.1 in this guide, but feel free to use any version you want, just change “7.1” to “7.X” in the commands.
Run the commands below to add the below third party repository to upgrade to PHP 7.1
udo apt-get install software-properties-common sudo add-apt-repository ppa:ondrej/php
Then update and upgrade to PHP 7.1
sudo apt update
Next, run the commands below to install PHP 7.2 and related modules.
sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-gmp php7.1-curl php7.1-intl php7.1-mbstring php7.1-xmlrpc php7.1-mysql php7.1-bcmath php7.1-gd php7.1-xml php7.1-cli php7.1-zip php7.1-imap
After installing PHP 7.1, Open WinSCP to edit the php.ini file.
WinSCP is a free Remote Visual File manager that works over SSH, it makes things a lot easier from managing and editing files with putty.
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 //You can increase this if you server can handle upload_max_filesize = 100M max_execution_time = 360 date.timezone = America/NewYork //Set you Time Zone here
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_Password_Here';
Then grant the user full access to the database.
GRANT ALL ON mailwizz.* TO 'mailwizz'@'localhost' IDENTIFIED BY 'Enter_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:
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:
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:
7- Unzip the “latest.zip” file using the following command:
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.
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 php-xml
sudo apt install php-mbstring
sudo apt install php-curl
sudo apt install php-zip
sudo apt install php-imap
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 /folderpath
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 (review step 4)
- Password: Enter Your DB Password (review step 4)
- Database name: mailwizz (review step 4)
Click Next and Create Your Admin Account.
Great, we are almost done!
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?
Simply Cron Jobs are scheduled tasks that run automatically upon a schedule.
For example, if you created an email campaign that runs automatically every week. you need a task to run in the background automatically to trigger this campaign, this is the role of Cron jobs, so lets set it up.
To make things easy for you, you will just need to copy the jobs you see in the setup and past them on your server.
Where to paste them?
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
Copied your cronjobs? Save the file
That's it! Enjoy MailWizz. !
Optional: Secure with a Free SSL.
SSL certificates are used within web servers to encrypt the traffic between the server and client, providing extra security for users accessing your application. Let’s Encrypt provides an easy way to obtain and install trusted certificates for free.
Connect to your Server using Putty SSH client. and Let's Start!
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
You’ll need to 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
Generating the SSL certificate for Apache using Certbot is quite straightforward. The client will automatically obtain and install a new SSL certificate that is valid for the domains provided as parameters.
Simply run the following command: (change the domain)
sudo certbot --apache -d your_domain
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
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
Test our website now.