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.
No thanks.
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 time
- A credit card and billing address
- A sense of courage
Introducing Sendy
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.
Digital Ocean
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.04
- Choose a Size: Under Standard Droplets, choose 1GB ($5/month)
- Add Block Storage: none
- Choose a Datacenter Region: New York 3
- Select additional options: None
- Add your SSH Keys: (Optional) None
- Choose 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.
Domain Forwarding
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 Record
- Host Name: sendy
- Points 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 typelike 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.
ssh root@your.droplet.ip.address
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):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
------------------------------------------------------------------------------- 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 for production. 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, and you 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 the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable 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:
tail /root/.digitalocean_password
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:
mysql_secure_installation
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.
1 2 3 |
Enter 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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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:
exit
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<?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:
apt-get update
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:
1 2 |
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.)
1 2 3 4 |
sudo 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.
Enable mod_rewrite
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:
ServerName sendy.yourdomain.com
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:
1 2 3 4 5 6 7 |
<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:
1 2 3 4 5 6 7 8 9 |
<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.
Restart Apache
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.
reboot
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:
- Desktop
- OSX:
~/desktop/
- Windows:
C:Users(username)Desktop
- OSX:
- Downloads
- OSX:
~/downloads/
- Windows:
C:Users(username)Downloads
- OSX:
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/ root@your.droplet.ip.address:/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.
Touchdown!
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
21 comments
J
November 7, 2017 at 11:28 amDidn’t see a date on this, is the info for the related companies still pretty accurate? This is the best outline of how to set it up I’ve seen so I’m about to take the plunge!
Dave Kiss
November 8, 2017 at 10:41 amYep, should still be good! Let me know if you run into anything unexpected 👍
J
November 14, 2017 at 1:13 pmAwesome, thanks. If I end up going for it I’ll let you know how a medium-skilled tech guy handles it!
J
November 14, 2017 at 1:19 pmA few things that are unclear to me. Can you use a domain name/hosting that also has a web site attached to it, and can you utilize one server for multiple domain names (like a kind of “masking” thing). Thanks!
Logan
November 10, 2017 at 5:19 pmOnly LAMP image I saw was on ubuntu 16.04 so I picked that one. When I got to the “Edit Servername” step, the
000-default.conf
file I see is different — it has a “ServerAdmin” line but no “ServerName” line.Chris
January 12, 2018 at 1:09 pmDid you find a fix Logan ? I am having the same issue.
Chris
January 12, 2018 at 1:08 pmHi,
Everything going ok, except I can’t edit the ServerName as I can’t find that line.
http://prntscr.com/hzktk7
P.S. I am afraid I will have issues uploading Sendy, as the windows 10 is using a ssh client and I doubt I can point it to the sendy file in my laptop. What’s the digital ocean ftp port ? Anybody knows ?
Doug
February 26, 2018 at 3:22 pmLAMP 14.04 was not available so I went with the LAMP 16.04
all was working fine (with minor changes) till I got to “Install the cURL PHP and NTP extensions” part.. now I’m pretty lost, not a developer at all so this is all new to me. Any updated info for installing on LAMP 16.04
Dave Kiss
March 8, 2018 at 11:28 amHey Doug,
I’ve just gone through this article and updated for the updated LAMP 16.04 one-click app provided by Digital Ocean, so everything should be up to date here. Let me know if you run into anything else!
Paul
March 15, 2018 at 4:17 amHi Dave
Thanks so much for putting together this article – I now have a successful Sendy install!!
Couple of stumbling points for me along the way, which may help others.
The CLI – I am on Windows and installed PuTTY, which worked well.
I could not get the final rsync commands to work – so I used Filezilla to sftp the files and that worked.
Once again, many thanks
Robert
May 1, 2018 at 10:25 pmAwesome. I had issues with it being unable to verify my quote for SES. I must’ve done the sudo part incorrectly. I redid that & it went through.
I also didn’t have enough patience! It took a full business day to complete everything, mostly waiting on Amazon AWS
Braulio R. Urbina
July 28, 2018 at 11:39 amGood morning Dave, do you have any such tutorials for the same process when done by hosting on our own physical server instead of using a droplet from Digital Ocean
Dave Kiss
August 1, 2018 at 9:48 amYou should be able to follow the same advice in this article, ignoring anything that is specific to digital ocean, and it will work the same!
T
August 4, 2018 at 10:11 pmHey Dave,
On your other article, you mentioned you were using fail2ban with sendy. However didn’t provide any information with how you configured it. Currently sendy will allow anyone to try as many passwords as they want without being locked out. I’d like to know if you have set up fail2ban to deal with this?
Pingback:
Trevor Owens
October 15, 2018 at 2:34 pmI got an error, “Can’t connect to database” and took me two hours to solve.
Basically, I needed to open mysql, connect to the sendy database and create a new user with a new password. Then I used that user in the config.php. Hope this helps save someone some time.
Trevor Owens
October 15, 2018 at 3:09 pmCREATE USER ‘newuser’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON * . * TO ‘newuser’@’localhost’;
Sumeru
October 18, 2018 at 5:06 amDo you have a similar guide for Amazon EC2? I’m clueless as I’m not Siteground with the easy to use Cpanel/File Manager at the moment.
Jessica
January 31, 2019 at 1:18 pmHi Dave. Thanks for this! I think I’m going to set this up today. I have a question about the server though. I have a list of 15,000 +. What server size should be sufficient for me to ship emails smoothly? If it means anything, I’m set up with Mandrill and I can send over 120k emails per hour.
Robert
May 15, 2019 at 12:01 pmHey Dave, I was trying to update my Sendy, so I decided to just follow the entire list again. I ran in to a problem with php7.0-curl. The install says it is not available.
Muhammad Rehan
May 16, 2019 at 3:38 amI have a managed DigitalOcean server which is powered by cloudways and the server configuration consists of:
RAM 2GB
Processor 1Core
Storage 50GB
Bandwidth 2TB
You can see the additional features of the server here: cloudways.com/en/digital-ocean-cloud-hosting.php
So, is this right server size to go with mailchimp clone.