Mandrill just announced that they are requiring all of their users to have a paid monthly MailChimp account by the end of April. As a heavy Campaign Monitor user, I completely understand why they are doing this, and don’t fault them in the slightest for it. However, this complicated things substantially for me, and one of my more vulnerable clients.
A little over a year ago, I built a web application for our local public school district so they could more easily handle class signups for their GATE program. Like most web apps, it needs to send transactional emails for password resets, signup confirmations, and things like that, so I set up a Mandrill account.
Our town is small, and the GATE program is a tiny subset of the small district as a whole, so we’re not sending a lot of emails here. I think last year just over 500 were sent. Mandrill currently allows you to send up to 12,000 for free each month. This was great, because like all public school districts in the US, ours is low on money and high on bureaucracy. Paying for a service like this set up by a freelance contractor is probably against 1,000 different rules. Our schools frequently have to ask parents for copy machine paper donations, so I don’t think $9/month to send 42 emails is in the cards.
I definitely don’t fault Mandrill/MailChimp for this change. Campaign Monitor (which also doesn’t have a free tier) recently launched one of the nicer transactional email systems I have ever used. This is an obviously a step in the right direction for them, but a direction that totally sucks for my client and I. So I need to find a new service all of a sudden.
Preparing your DreamHost VPS for Mailgun
In my scramble, I found this great chapter on Transactional Email in Zapier’s The Ultimate Guide to Email Marketing Apps. It’s pretty up to date, and gives a pricing grid for each service. I checked a few out, but went with my gut instinct which was Mailgun.
Being that my client is budget-minded, a DreamHost1 VPS was my go-to hosting plan. It’s hard to beat $8/month, and the LAMP platform is extremely portable when I inevitably need to pass the website off to my client down the road. Unfortunately, the default DreamHost configuration isn’t set up for Composer—a requirement for the Mailgun PHP library.
Setting Mailgun up locally was totally strait forward and took all of 20 seconds, I think. I have never used Composer (and really have no interest to), but you can install it on a project by project basis, which is what I preferred. I like to keep my projects as simple and self-contained as possible.
Getting the VPS up and running was a bit more involved, however. I first had to upgrade to PHP 5.6, which is on DreamHost (and most other VPS hosts I’ve used) is mostly a matter of selecting it in your control panel and saving changes. You also need to make sure your shell is using PHP 5.6, though.
To see which version of PHP your Command Line Interface (CLI) shell is using, SSH to your server and run:
DreamHost defaults to PHP 5.5 for the CLI shell, so if this is your case, you’ll need to add a line to your your .bash_profile. This file lives inside your user directory. You can SSH to this directory and update the file via the command line with these instructions, or you can just use your SFTP client and edit the file in a text editor. Add this line to the top and save the file:
Installing Composer requires that you enable the Phar extension on your server. This is just a matter of adding the following lines to the phprc file that lives in /home/username/.php/5.6/phprc home directory:
extension = phar.so suhosin.executor.include.whitelist = phar
If you don’t have a ~/.php/5.6/phprc file in your user directory, just create it.
Save the file, then SSH to your server and run:
php -m | grep Phar
This should output “Phar” if it worked.
Now you can install composer. I installed it locally. SSH to the directory of your project, and run:
curl -sS https://getcomposer.org/installer | php
Yes, it’s a total pain in the ass, but the PHP Mailgun library should work. I still haven’t finished setting everything up on the server, so I’ll update this post if I run into anything else.
Clients vs. complexity
As a developer, or rather; project manager, it’s your job to shield your clients from complexity, but so much of modern web development is focused on speed. This almost always adds complexity. Further, much of the developer market caters to the industrial complexities complex. We like fussy shit that helps us get our projects up and running quickly and modularizes development. The problem is that we all have different tastes, our products need to play nicely with multiple services, and they need to run in multiple environments.
I don’t want to have to install multiple package managers to manage dependencies for multiple services. It adds unnecessary complexity to the project, and often—as in this case—ends up taking more time setting things up on the production server than it saves you setting up your development environment. When it’s time to pass a project off to another developer or hand it off to my client, I want it to be as lean and mobile as possible. This adds value to my products.
It can be extremely challenging to build a quality product for a client with limited funds and resources that is portable, resilient and reliable. Yes, you do get what you pay for, but many clients (such as public education, non-profits, and marginalized groups) deserve much more than they can afford. For these clients, recurring costs need to remain at a minimum, which means building systems that can easily be migrated or modified to use different services as pricing models change is critical.
- DreamHost has been in the hosting business since 1997—almost as long as I have been making websites. ↩