How To Create Your Own Bulk Email Server Using Virtualmin & PHPList on a VPS running Ubuntu 14.04?

If you have ever used mailing software like MailChimp, Aweber, GetResponse or Constant Contact, then you would know how costly these services become as the number of subscribers and emails increase in your campaigns. Well here is the last solution you will ever need for your bulk email marketing campaigns. We offer a one-time solution which is your very own personal Bulk Email Server that you can create yourself using some free and open source software like Ubuntu, Virtualmin, & PHPList.

All you have to do is buy a VPS with 2GB RAM from a good company like DigitalOcean, Linode or any other company of your choice. Then just follow the simple instructions given in this tutorial to create your very own bulk email server. You should be able to accomplish this even if you are a semi-technical person. In case if you are still not able to do it yourself, or are stuck somewhere, just reply to us in comments.

Or You Can Just Let Us Do It For You!

You can also drop us an email or call us in case you want us to do all the hectic tasks for you to give you your personal email server. All we charge is a $100 per server deployment. Apart from that you only have to pay your hosting company per month for the VPS. Once deployed you can run it for as long as you want to.

Why create your own Bulk Email Server?

1. Very Low Cost:

All that a bulk costs you is a $10/month. This is only the cost of the cheapest VPS that you will need to create your own bulk email server. Everything else, including the Operating System, Control Panel, Application Software is free. At least the ones that we are going to use in this tutorial are free.

2. Add Unlimited Subscribers

In your own bulk email server, you will be able to add as many subscribers as you want there will be no restrictions or extra cost for adding more subscribers. On the contrary, MailChimp is free only till 2000 subscribers. 

3. Send Unlimited Campaigns and Newsletters

Using your own bulk email server you can send as many campaigns or newsletters as many time you want in a month, a week or a day.On the contrary, MailChimp is free only till 12000 emails per month. 

4. Very Easy To Use

Though this process of creating this server might be a little technical. But once it has been deployed, it is very easy to use. The bulk email software called PHPList that we will be using in this tutorial is very simple and mostly self-explanatory.

What You Will Need?

  1. A VPS with 2GB RAM Ubuntu 14.04 LTS Preinstalled: that you would have bought from a hosting company. Remember you don’t need those VPS with a cPanel installed. You can buy much cheaper VPS on DigitalOcean or Linode. A 2GB RAM VPS at Linode costs merely $10 a month and that is what we will be using in this tutorial.
    Why Ubuntu 14.04 LTS Only?
    We will be using Ubuntu 14.04 only because firstly it is a long term support version. And secondly, this is the only version in which setting up the server will be a breeze. I have faced issues in Ubuntu 16.04, CentOS 7 &  even CentOS 6. And since we want our server setup to not have any extra glitches to be fixed we will go for the tried and tested Ubuntu 14.04.
  2. Putty: is an SSH client which will be used to access our VPS and run commands on it. You can download it here.
  3. A New Domain Name: you will need a separate domain name for your email server. If the domain name of the website of your is abc.com then just buy abcmail.com for your email marketing. But don’t use the same domain name for your official and marketing emails. So, that if the marketing emails go into spam then the official emails are not hampered.
  4. PHPList: PHPList is a free and open source bulk email software that can be downloaded here.
  5. Virtualmin: Virtualmin is the control panel that we will be using to control our VPS and various application servers that will be installed on it.

So, let’s get started.

Steps To Create Your Own Bulk Email Server

1. Create a VPS (with 2GB RAM & Ubuntu 14.04) and Access it remotely through Putty.

2. Setup the Glue Records & Nameservers For Your New Server.

3. Change the hostname to your domain name.

Check: hostnameChange:-

(Ubuntu)

1. hostname host.yourdomain.com

2. Change /etc/hostname: cat /etc/hostname then vi /etc/hostname

3. Change /etc/hostscat /etc/hosts

cat /etc/hosts
vi /etc/hosts

Now change/add 127.0.1.1 host.yourdomain.com

Change:- (CentOS)1.vi /etc/sysconfig/networkHOSTNAME=host.elanzaexportmail.com2.vi /etc/sysconfig/networkAdd a new line.IP_ADDRESS_OF_SERVER host.elanzaexportmail.com host3.Run: hostname host.elanzaexportmail.com4.Run: /etc/init.d/network restart
Now check again: hostname then hostname -f
Then relogin to check if it reflects in the command prompt:-shutdown -r now
# install wgetCentOS: yum install wgetUbuntu: apt-get install wget

 

# Update the system:

apt-get update

Though virtualmin installation will try to update the syystem itself. But its a good habit to do it yourself.
CentOS: Yum updateUbuntu: apt-get updateIf it is stuck at 0% : 0% [Connecting to security.ubuntu.com (2001:67c:1562::16)]Then use this solution:-https://askubuntu.com/questions/574569/apt-get-stuck-at-0-connecting-to-us-archive-ubuntu-comorhttps://askubuntu.com/questions/620317/apt-get-update-stuck-connecting-to-security-ubuntu-comRun: vi /etc/gai.confchange line ~54 to uncomment the following: precedence ::ffff:0:0/96  100

 

# create a new downloads folder inside the root foldercreate a new virtualmin folder inside the downloads folder
# Download Virtualmin Install Script

wget https://delhideveloper.com/wp-content/uploads/2017/08/install.zip

You can also download the latest script from another URL:-

wget http://software.virtualmin.com/gpl/scripts/install.sh

(But don’t do it as the latest script installs PHP7 which has some problems with phplist)

# goto the downloads folder and run the scriptsh install.sh

 

 

** It will ask you before running the script with a warning that if your operating system is not listed above then installation will fail.Select y & enter

# After installation is complete in half an hour.Visit: https:your_vps_ip_address:10000Eg: https:102.201.54.45:10000

 

 

# Virtualmin Post Installation Wizard Starts
1.This post-installation wizard allows you to configure Virtualmin optimally for your system. You can make selections depending on whether you want to host websites, email or databases, and based on your system’s memory and CPU power.To continue, click the Next button below. To skip it and use the default settings, click Cancel.
2. Preload Virtualmin libraries? YesRun email domain lookup server? Yes
3.Run ClamAV server scanner? YesIf error show, then run below commands and try again:-/usr/bin/freshclam/usr/sbin/clamd
4.Run SpamAssassin server filter? Yes
5.Run MySQL database server? YesRun PostgreSQL database server? Yes
6. Enter MySQL Password
7. Check:  Huge system (2G or more) on which MySQL is heavily used

8.Primary nameserver: ns1.elanzaexportmail.comSecondary nameservers (optional): ns2.elanzaexportmail.comCheck: Skip check for resolvability
9. Check: Only store hashed passwords

10. Installation wizard is complete.Click Next

 

# Install the new themeClick on the switch theme button in the message.
# Click on: Recheck & Refresh Configuration button.Wait for the message:  your system is ready for use by Virtualmin.
# Verifify that all the Servers are running.
# Update packages.Then refresh available packages. To see this message: “found 0 possible updates”.

 

# Just check the list of DNS Zones in Bind DNS once.
# Now create a new Virtual Machine for the primary domain.
1. In virtualmin click on create new Virtual Server.
2. Enter domain name and password in the form.In enabled features: Check everything including:Setup SSL website too?Setup IP-based virtual FTP?
Click on “Create Server” Button.Let the script run completely.
4. Check if the new DNS Zone has been created for elanzaexportmail.comGoto: Webmin->Servers->Bind DNS Server.Click on All.Verify that it has ns1, ns2 and host entries as A records.
3. Now log out and log in with the domain name followed by port number.https://elanzaexportmail.com:10000
# Install SSL Certificate on the new Virtual Server.Goto: Virtualmin.Ensure the right Virtual Machine is selected on the top.Goto: Server Configuration->Manage SSL Certificate.Click on last tab (Let’s Encrypt).Check: “Domain names listed here”.Enter the following domain names:- elanzaexportmail.com www.elanzaexportmail.com host.elanzaexportmail.comClick on “Request Certificate”. 
Update: Don’t install it for host.delhidevelopermail.tk as it will have problems in renewal. You can use “delhidevelopermail.tk:10000” instead of “host.delhidevelopermail.tk:1000” after the Virtual Server has been created for the domain.

# Install the same SSL certificate to Webmin, Usermin, Dovecot, Postfix, ProFTPD.Restart chrom to see if the SSL certificate reflects.Again click on “Manage SSL Certificate”.

 

 

# Create a new MySQL database and user for this Virtual Machine.1. Goto Virtualmin->Edit DatabasesClick on “create a new database” Button.In “Additional Options”:Select UTF-* for encodingAnd utf8_general_ci for CollationEnter the database name (phplistdatabase) and click “Create” button.
2.Goto Virtualmin->Edit UsersClick on “Add a new User to this server” button.Inthe “Virtual domain user details” tabl enter the user email (phplistuser) and password.In the “other user permissions” tab, add the newly created database in the “Grant Access To” list.Click on create.From the users list copy the “IMAP/POP/FTP Login” value from the table for the new user. This will be the MySQL username.
But wait: sometimes Virtualmin changes the username for the MySQL users because of the limited length of MySQL usernames.So goto: Webmin->Servers->MySQL Database Server->User Permissions and check to see if the username is there listed there. If the username is different from what you expected than note it down. User this different username for MySQL for everything else the normal username will do perfectly fine.

 

# Log out and login to the virtual machine.

# Install PHP List.You can also follow these instructions:-https://www.phplist.org/manual/ch028_installation.xhtml
1. Goto Webmin->Others->File Manager
2. Create a new directory by the name: phplist
3. Get the link of latest phplist:-Goto: https://www.phplist.org/download-phplist/Click on “Downoad Zip”.Copy the direct link from the sourceforge page.
4. In Webmin File Manager:-Goto File-> Download From Remote URLPaste the copied URL.Leave the username and password empty.Run.
5. Rename the file to “phplist.zip”.
6. Extract the zip file.
7. Inside that new extracted folder goto the “/public_html/lists/” folder and copy all its contents to the phplist folder created by us.(Note: Don’t confust this public_html folder with the public_html folder of your server.)
8. Remove the zip and its extracted folder from the phplist folder.

9. Edit phplist/config/config.php through Webmin File Manager.In the config file set the following values:- $database_host = ‘localhost’; $database_name = ‘phplistdatabase’; // Name of the MySQL database that you created for PHPList $database_user = ‘phplistuser.elanzaexportmail’; // Name of the MySQL User that you created for PHPList $database_password = ‘Elanza@123’; // Your password for Virtual ServerChange $pageroot value:- $pageroot = ‘/phplist’;Set the value of defined constant ‘TEST’ to 0:- define(‘TEST’, 1); To define(‘TEST’, 0);Set the name of SMTP Server:- define(‘PHPMAILERHOST’, ‘elanzaexportmail.com’);Set SMTP Username & Password:- $phpmailer_smtpuser = ‘phplistuser.elanzaexportmail’; $phpmailer_smtppassword = ‘Elanza@123’;Set SMTP Port Number:- define(‘PHPMAILERPORT’,587);Set SMTP Security Protocol to ‘tls’:- define(“PHPMAILER_SECURE”,’tls’);

# Now visit : https://elanzaexportmail.com/phplist/You will see a database error because there are no tables in the database.

# Now visit : https://elanzaexportmail.com/phplist/admin/There will be a message: “Database has not been initialised. go to Initialise Database to continue”.
Click on “Initialise Database” link.

 

#  On the “Initialise The Database” pageEnter your own name, company name, the email address of the same MySQL user “phplistuser@elanzaexport.com”Password.
Click continue.
Notice that the initial username will be “admin”.

# In the next pageThe tables will be made.Now just click on “Subscribe” to receive latest updates (if you want).
# Then on the same page click on “PHP List Setup” page.

 

# Now just logout and login again to see the complete menu.The username is again: adminPassword is just as you had set.

 

# Click on Campaigns>Send Campaign.Click on “Start a new Campaign”.Enter any Campaign subject and message.Scroll down to the send test.

# Now open a new tab and visit: dkimvalidator.comCopy the email address from the field that says: “Here is a random address that you can use:”.This email will be something like: random_text@dkimvalidator.com.Paste this email to the “Send Test” field of the phplist tab, paste this email address.Click on “send test” button. When page refreshes. Click on “Add Email” button. Then Click on “Send Test” button again.
# Now in the DKIM validator tab again and click on results.Keep on refreshing the page until it says “I haven’t received an email to random_test@dkimvalidator.com”.Notice that the DKIM test failed in the results.This is because phplist is using default php mail function instead of the SMTP server (named Postfix) installed while installing Virtualmin.

 

# Now login to the Virtualmin as root.Goto Virtualmin->Email Messages->DomainKeys identified MailIf “DKIM filter package” has not been previously installed, then you will se an “Install” button.Click on that button to install the “DKIM filter package”.After the installation finishes click on “Return to DKIM Form” button.Select “Yes” for “Signing of outgoing mail enabled?”.In the “Selector for DKIM record name” type current year. Don’t use “default” DKIM selector, it sometimes does not work in Virtualmin.Click on “Save” button.

 

 

# Now lets enable email encryption in Postfix:-Goto: Webmin->Servers->Postfix Mail Server->SMTP Client OptionsCheck “Yes” for “Use TLS for SMTP connections” option. This will help you send Encrypted Emails. And no gmail user one will see those red locks in the emails sent by you.Click “Save and Apply”.

 

# One last thing:- (Very Important)There is something called Reverse DNS.It means that your IP Address should resolve to your hostname.But this is something in control of your VPS Hosting company.You will need to ask them to change the reverse DNS value to your hostname.Some hosts do it automatically like DigitalOvcean.Some also provide an interface to do it, like Linode does.In Linode goto Linodes->Select Your Linode->Remote Access->Reverse DNS.Now enter your hostname for the reverse DNS. And save.Use whatsmydns.net to check PTR records which is the reverse DNS record.Reverse DNS can take upto 24 hours to propagate globally.

 

# You can also use this very amazing tool to test if the emails are going properly or debug email sending:-https://www.adminkit.net/smtp_diag_tool.aspxI used the same tool to realise that Ubuntu 16.04 LTS has some problems with Postfix in Ubuntu and should not be used to create such a mass mailing server.

 

# Create a directory named “uploadimages” in the public_html of the Virtual Machine.This folder will contain all the images that will be uploaded to be sent with the emails.1. Goto: Webmin->Others->File Manager2. Click on Edit->create Directory3. Name the directory: “uploadimages”DONE.

 

# Install Image Magic for sending images with the emails:-These commands will install imagemagic for PHP5.5 in Ubuntu 14.04.These can be found here: https://askubuntu.com/questions/560696/having-problems-installing-imagemagick-on-ubuntu-14-041. sudo apt-get install imagemagick2. sudo apt-get install php5-imagick3. sudo php5enmod imagick4. sudo service apache2 gracefulOtherwise you will see this error while uploading images.”Cannot find any of the supported PHP image extensions!”

 

 

 

 

 

 

 

22 thoughts on “How To Create Your Own Bulk Email Server Using Virtualmin & PHPList on a VPS running Ubuntu 14.04?”

  1. Hi, do you still not recommend ubuntu 16 with phplist? What’s wrong with it? I tried it and it seems to work fine except i am hosting it on my own server and isp. However, i can’t get the reverse dns. Do i ask my ISP? Thanks

  2. my dns zone was not created under bind dns server..all dns records show under dns records..i tried to create master zone but it says zone already exists..please help

  3. im just setting out an outgoing email server. email is going spf is pass. but im not able to get dkim signing. the server i made is subdomain. the main domain is another server as im keeping website at different place. do you have idea why my dkim is not signing. are you able to look at my system. its kind of urgent now because ive looked at this too many hours now already. reply me and we can talk over skype. thanks.

  4. Very very useful video!
    I setup 2 new mail servers on linode watching this video
    Server 1 config : ubuntu 14.04 LTS with phplist 3.3.1 as shown in video but after installation i update to phplist 3.5.5 as system does not allow older version of phplist
    Server 2 config : ubuntu 20.04 LTS with phplist 3.5.5 with latest versions
    Both servers are installed successfully with no issues.
    But when I am sending test mail to dkimvalidator, phplist shows success but in dkimvalidator it shows mail not received
    Same happens when I am sending mails to different emails
    Facing this problem in both the mail servers
    Plz find and share solution for this issue
    Thanks again for this helpful tutorial

  5. hi how can we fix this error in phplist
    Database error 1366 while doing query Incorrect integer value: ” for column ‘template’ at row 1

  6. Hello,
    As dkim validator is now unavailable. So please recommend the alternate (dkim). As i have followed your each and every steps shown in video, bt still in php list it’s failed!!!!! Any other dkim operator suggestions ????

  7. you are very good, my problem is, i can send message out from virtualmin email address, but i can not receive email from the same account, what will i do to solve the problem? please help me

    i use contabo ip ubutu
    cloudflare as dns
    freenom domain

Leave a Comment

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

Scroll to Top