Alright, I hate to say it. I wanted to love that cute and cuddly monkey – but I’m a little fed up with MailChimp.
My email lists grow slowly and organically at a little under 100 subscribers a month. It wasn’t until recently that I surpassed the free account limitation of >2000 subscribers. I’m typically quite happy to pay for a service that helps enable my small business to grow and prosper.
The thing is, I don’t send email frequently enough to warrant paying $50 a month for the unforeseeable future (forever?)
I also don’t like the pressure that it puts on me to either “use it or lose it,” forcing me to send out sub-par emails just so I feel like I’m getting my money’s worth.
Of course, there’s also the “pay-as-you-go” plan, which asks for upwards of $75 for sending a single campaign to my list.
So I did some searching, and found an even better answer that allows me to host my own MailChimp clone on my own server for a measly $5 a month using the highly reliable Amazon SES service, (okay, maybe $6 after the Amazon bill), saving me money and the frustration of receiving an overpriced bill for an underused service.
That’s more like it.
Now, in this tutorial, I’ll show you how you can set up your own, too.
Requirements:An hour of timeA credit card and billing addressA sense of courage
Sendy is a self-hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES). This makes it possible for you to send authenticated bulk emails at an insanely low price without sacrificing deliverability.
The initial investment for the software will set you back $59, but considering this might be what you already spend per month on your MailChimp account, it is certainly a solid investment.
After you purchase, you’ll receive an email receipt containing a download link to grab your copy of Sendy and a license key that allows you to obtain updates and email support in case you run into any trouble.
Go ahead and download the Sendy installation and let’s get going on setting this puppy up.
For the purposes of this tutorial, we are going to set up the Sendy software on a VPS over at Digital Ocean. It’s a great alternative to traditional shared hosting because it is built on super fast solid state drives and it is very friendly on the wallet.
If you’re new to Digital Ocean, you can sign up through this link and receive a free $10 credit, good for two free months of Sendy hosting.
After you’ve created and logged in to your Digital Ocean account, it’s time to start setting up the server.
Create a New Droplet
DigitalOcean calls its virtual private servers droplets; each droplet that you spin up is a new VPS for your personal use. The setup is very easy – let’s create one now.
Start by clicking the green Create button at the top of the sidebar menu and choose Droplets.
Choose an Image: Click on the One-Click Apps tab, and choose LAMP on 16.04Choose a Size: Under Standard Droplets, choose 1GB ($5/month)Add Block Storage: noneChoose a Datacenter Region: New York 3Select additional options: NoneAdd your SSH Keys: (Optional) NoneChoose a Hostname: Sendy
Once you’ve selected the options above, click the big green Create button at the bottom of the page.
After about a minute, you should receive an email that contains information related to the new droplet that you just created, including your server’s IP Address and root password. Keep this email handy – in fact, I’d recommend saving that data somewhere in a safe and secure place for future reference.
Now that you have a droplet ready to go, you’ll need to configure your domain name so that it sends you over to your new server when you visit the site in your browser.
To do this, you’ll need to add an A record on either your domain registrar’s site or your hosting provider’s site. This might be GoDaddy, HostGator, Hover, NameCheap, BlueHost, or even somewhere else.
If you don’t have a domain name yet, I’d recommend NameCheap as a quick and easy way to purchase a new domain name and get it set up quickly.
If you do have a domain name, but you’re not sure where it is registered or hosted, you can find out by visiting who.is and searching for your domain name. When your results load, you’ll see the root domain name of your hosting provider under the Name Servers section.
The process of Adding an A record is a little different for each hosting provider. The best way to find out how to do this in yours is to search for Adding A record NameCheap on Google, replacing NameCheap with your actual hosting provider. This will take you to an article that describes the process, which is a fairly simple task.
There are 3 values you’ll need to enter for your new record:
Record Type: A RecordHost Name: sendyPoints to IP/value: your.droplet.ip.address (this came in the email from Digital Ocean)
Once you click save, you should be able to visit sendy.yourdomain.com and see a generic Apache page being served by your Digital Ocean droplet. Oh yeah!
Configuring your Droplet
Note: if you are comfortable accessing servers via shell, you can skip down to the Connect to your droplet section below.
Forewarning: remember how I asked you earlier if you were feeling bold?
This is going to be the part that scares most people away. But you are ready. You can do this. We’re in this together, and with the power of two we can do anything! Besides, all you really need is to be good at following linear instructions.
We’re going to use Terminal or Command Prompt to log in to your Digital Ocean server via Secure Shell.
These programs offer a command-line interface (CLI), which is a means of interacting with your droplet where you’ll issue commands to the droplet in the form of successive lines of text. That’s right baby, no menus or shiny icons here. You’re a real hacker now.
It’s time. Let’s open your CLI and get rockin.
OSX: Terminal is located in the Applications/Utilities folder. Alternatively, you can use Spotlight to search for and open it.Windows: Command Prompt is found in different locations based on the Windows version you have. Here are instructions for Windows 8, Windows 7, Windows Vista, and Windows XP
You’ll know you’re ready to go when that big, scary, empty blank box pops up. For the remainder of this tutorial, we’ll call this box the CLI.
Connect to your droplet
A quick note: the sections below using a convention of highlighting text to show what you must enter into your CLI. If you see text that looks like this, it means that you should literally type like this into your CLI and press enter.
The first thing that we want to do is to log in to your droplet using your CLI. Remember that email that you received from Digital Ocean? Now is the time that we’ll need it. Type the command listed below in your CLI, replacing your.droplet.ip.address with the IP address listed in your Digital Ocean email.
Of course, when you attempt to log in anywhere, you are going to be asked for your password. The Digital Ocean email also contains the password that you now need to enter. Simply copy it from your Digital Ocean email, paste it in your CLI and press enter.
You might not see the traditional ****** or ••••••• characters when you paste your password into your CLI, but it is still being pasted successfully.
If all goes well, you should see a message similar to this appear in the CLI (don’t type this):
123456789101112131415161718192021222324252627282930313233343536 -------------------------------------------------------------------------------Thank you for using DigitalOcean's LAMP Application. LAMP has now been enabled. You can access your LAMP instance at:Your web root is located at /var/www/html and can be seen from http://your.ip.address.here The details of your PHP installation can be seen at http://your.ip.address.here/info.php The "ufw" firewall is enabled. All ports except for 22, 80, and 443 are BLOCKED You are encouraged to run 'mysql_secure_installation' to ready your server forproduction. The passwords for MySQL have been saved to: /root/.digitalocean_password Let's Encrypt has been pre-installed for you. If you have a domain name, andyou will be using it with this 1-Click app, please see: http://do.co/le-apache ------------------------------------------------------------------------------- You can learn more about using this image here: http://do.co/lamp1404 -------------------------------------------------------------------------------To delete this message of the day: rm -rf /etc/update-motd.d/99-one-click The programs included with the Ubuntu system are free software;the exact distribution terms for each program are described in theindividual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted byapplicable law. root@sendy:~#
Sweet, we’re in! The first thing you’ll want to find is your MySQL root password. The note above says the password is stored in a file located at
/root/.digitalocean_password, so let’s fetch the contents of that file and print it to the screen by entering the following command:
Select the password (don’t forget to remove the quotes!) and copy and paste it somewhere safe – we’ll need to use it in a minute and it’s a good thing to keep stored somewhere secure in the long run.
Now, let’s remove that welcome message so it never shows again:
rm -rf /etc/update-motd.d/99-one-click
The message is suggesting that we run mysql_secure_installation, so lets go ahead and do that now:
This is going to start asking us a bunch of questions. The first is to enter your MySQL root password which we just saved from above. Again, it may not show up as you paste it in, but that’s okay.
123Enter current password for root (enter for none): OK, successfully used password, moving on...
The rest of the questions can be answered by typing a simple
Y for yes or
n for no. The proper responses are listed below:
12345678910111213141516171819202122 Would you like to setup VALIDATE PASSWORD plugin? [Y/n] n ... skipping. ...Change the root password? [Y/n] n ... skipping. ...Remove anonymous users? [Y/n] Y ... Success! ...Disallow root login remotely? [Y/n] Y ... Success! ...Remove test database and access to it? [Y/n] Y ... Success! ...Reload privilege tables now? [Y/n] Y ... Success! ... All done!
Nice and easy.
Create the Sendy database
Sendy needs a place to store all of the great newsletters and subscribers that you’ll be managing, so let’s create that now. We’ll using a program called mysql to get a new database set up for Sendy to use with this command:
mysql -uroot -p
You will be prompted to enter the same MySQL Root password for the database user. Once you’re in, it’s just a matter of issuing a simple command to actually create the database:
create database sendy;
Ta-DA! We’re done with mysql, so let’s leave with this command:
Edit Sendy’s configuration file
How are you feeling? Ready to take over the world with your CLI skills? Maybe hack a matrix or two? Good.
Let’s take a short break from the CLI and edit Sendy’s configuration file to use all of the database settings from our newly-created droplet. Keep the CLI window open, and continue on.
Using Finder or Explorer, navigate to the location that you saved Sendy to when you downloaded it, and make sure to unzip the sendy-2.0.1 file by double-clicking it. Then, go to the sendy/includes/config.php file and open it up in your text editor.
You’re going to make changes to the Compulsory Settings section to reflect your Sendy database setting that you created earlier. Edit the file so that it looks like below, replacing yourdomain.com with your actual domain name, and AbCdEfGh12 with your real MySQL root password.
Remember, this is the same password that you were given when you logged in to your Digital Ocean droplet for the first time.
1234567891011121314<?php //----------------------------------------------------------------------------------// // COMPULSORY SETTINGS //----------------------------------------------------------------------------------// /* Set the URL to your Sendy installation (without the trailing slash) */ define('APP_PATH', 'http://sendy.yourdomain.com'); /* MySQL database connection credentials (please place values between the apostrophes) */ $dbHost = 'localhost'; //MySQL Hostname $dbUser = 'root'; //MySQL Username $dbPass = 'AbCdEfGh12'; //MySQL Password $dbName = 'sendy'; //MySQL Database Name
Once you are confident that you have entered the right settings, save your file and exit out of the text editor.
Okay, back to hacking. Head back over to your CLI and let’s get to work.
Install the Latest Server Updates
We want to make sure our droplet has the latest updates for all of the software that came preinstalled on it. This command will help us out:
You’re going to see a lot of status output being spewed very quickly back onto the screen; just ignore it, and once it finishes throwing a fit, move along to the next step.
Install the cURL PHP and NTP extensions
Sendy requires a few extensions that don’t come preinstalled on your Digital Ocean droplet. This command will go grab them for us:
apt-get install php7.0-curl ntp
Again, you’ll be asked a yes or no question, to which you’ll respond
Y as shown here:
12 Do you want to continue? [Y/n] Y
More output will appear on the screen, and you’ll know it has finished once the output comes to a stop.
Ensure NTP clock is synced
This might be an optional step, but we’re going to do it just in case. Enter the following three commands, one at a time, ensuring our clock is synced with the Network Time Protocol (whatever that means.)
1234sudo service ntp stop sudo ntpd -gq sudo service ntp start
Note: any command that begins with sudo may ask you to enter your root password after issuing the command. This password can be found in the email that you received from Digital Ocean.
Sendy uses a concept of pretty permalinks to route all browser requests to the correct location, so we’re going to allow our PHP installation to use the rewrite module by using this command:
sudo a2enmod rewrite
Edit your site’s config file
We’ve made it to the trickiest part of the whole process: we’re going to edit our website’s configuration file so that it knows how to handle any visits that are made to your domain name.
We’re going to do this with a program called nano (cute, right?), which is a virtual text editor that will take over your CLI screen and transform it to a working application.
Let’s open the configuration file in nano by issuing this command.
sudo nano /etc/apache2/sites-enabled/000-default.conf
Note that although this window looks a little different from a traditional text editor like Microsoft Word, it actually behaves very similarly. You can use the arrow keys on your keyboard to move the cursor around in the text file and make changes.
Add the ServerName
We need to add a line to this configuration file that tells Apache what domain name you’ll be using with this droplet.
Using your arrow keys, move the cursor down a line and press enter to create space for our new configuration directive. Then, on the empty line you’ve created, type the following line, replacing yourdomain.com with your actual domain name:
Now, we want to edit the existing configuration for the block. You can use your arrow keys to move the cursor to the existing block, which should look something like this:
1234567 <Directory /var/www/html/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory>
Change the contents of this configuration block so it looks like this instead:
123456789 <Directory /var/www/html> DirectorySlash Off Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
Phew, we’re done here! Press CTRL+X to save the configuration file, and then press Y to return to your Digital Ocean droplet.
In order for our awesome configuration changes to take effect, we need to restart our Apache installation on our droplet. You can do that with this command:
service apache2 restart
Remove default files in server root
You’ll also no longer need that default generic Apache page you saw when visiting your new droplet in the browser earlier, so let’s get rid of it here:
rm /var/www/html/index.html /var/www/html/index.php
Change the permissions of the upload folder
Whenever you add an image or attachment to one of your newsletters, Sendy will save it to your Digital Ocean droplet in the uploads folder. We need to make sure that Sendy can access the folder, so let’s give Sendy permission by using this command:
mkdir /var/www/html/uploads && chmod 777 /var/www/html/uploads
We’re done with our droplet, so it’s time to disconnect and give our droplet a quick restart on the way out with this command.
We’re in the home stretch. Can you taste it? Victory is upon us.
Upload Sendy to your droplet
We’re at the last command, but it’s arguably the most important. Sendy needs to be uploaded to your droplet so that you can access it from anywhere in the world!
To do this, you’ll need to know the path to where your Sendy download is saved. This could be different based on your browser settings, but here are a few common locations:
Once you have the correct path to your Sendy download, enter the following command in your CLI, replacing ~/downloads/ with your actual Sendy download path and replacing your.droplet.ip.address with the IP address that came in the email from Digital Ocean:
rsync -avhrz -e ssh ~/downloads/sendy/ firstname.lastname@example.org:/var/www/html/
You’ll be asked to enter your root password found in the email you received from Digital Ocean.
If all goes well, you should see a list of all of the Sendy files being sent up to your droplet.
YES! We are all done here. I knew you could do it, champ. Close down that CLI and revel in your success.
There are still some steps to follow to ensure the Sendy software is ready to rock, but those are all unrelated to your droplet. To finish setting up Sendy, follow the remaining Sendy setup instructions, starting at Step 4.
Questions or comments? Use the comments below or hit me up on Twitter, @davekiss