TL;DR Summary
- Sendy.co is a lovely and polished PHP app that uses Amazon's SES (Simple Email Service) to send email on the cheap.
- It's easy to setup PHP apps on Windows Azure.
- Azure Websites don't support mod_rewrite so you port the rules to a web.config. There's a great Sendy web.config for Windows in this post you are welcome to.
- Sendy works well on Azure although they don't officially support Windows. I'm sure Sendy works great everywhere.
- I'm now running my Newsletter on Windows Azure with mails sent my Amazon SES
- Technical details below.
In search of a Cheaper Newsletter Solution
Why not a Rube Goldbergian solution? Well, it's not THAT bad. Here's the back story.
I started a little link blog newsletter a few months back, just for fun. You can subscribe at http://hanselman.com/newsletter if you like. It's a low-traffic once-or-twice-a-month little ditty, mostly to share the things I've bumped into on the internet with friends.
I started at TinyLetter.com which is brilliant for little low-traffic newsletters. However, this one has picked up steam and now it's hit the maximum number of subscribers that TinyLetter allows. TinyLetter is a front for MailChimp, so I look at their pricing. Looks like 5k-10k subscribers is $75 a month! Eek. Let me check SendGrid. They have a $79 a month option for up to 100k emails, but that's still $960 a year for a newsletter that sells nothing and serves no useful purpose. Yet.
I suppose I could charge people or get sponsors, but, meh, that takes work. I just want to send my list out. I could use my blog. Well, I do, but I like the high connectivity that a direct letter offers so I post the letter a few weeks letter so subscribers get the early scoop. Cleary folks dig it or they wouldn't sign up.
A twitter person told me about Sendy.co. It's a PHP app that you host yourself. It fronts Amazon's Simple Email Service (SES) which is dirt cheap for email. The app is REALLY polished and just lovely. It's $59 to buy, but they said on their site "If you encounter problems, we will help you. If it doesn't work out, we'll refund you." That matters to me, so I bought it on the spot.
I know nothing about PHP, though, but I know the web, so I'm sure I can figure this out.
The Sendy site says this MASSIVE DISCLAIMER:
What are the requirements?
You need PHP & mySQL support on a Unix like server, eg. Linux on Apache. Almost all hosting companies support them. IT ISN'T SUPPORTED ON WINDOWS AND YOU'RE A FOOL TO TRY.
Ok, I admit, I added that part at the end myself. But, I don't really feel like spinning up a Linode as I have Azure credits I'm not using each month. I'm sure this will work. Plus, if it doesn't, I'll spin up a PHP app at any of a thousand little hosts for minimum money. If it works, it'll be nice to have everything in once place.
Making a Sendy PHP app instance on the Windows Azure Cloud
I go over to Azure and make a new website with a MySQL database:
Next, inside of Azure I download the publish profile for my site. I also view the connection strings to the database because I'll need them to connect to the Sendy instance.
Then I download Sendy (after paying), unblock the zip and unzip it into a folder. I open the folder in WebMatrix. It installs PHP on my local machine so I can run it locally (even though I won't bother). I am using WebMatrix in this instance as a super easy way to publish to Azure directly.
I hit the Remote tab, then Settings to Import the publish profile I downloaded. Don't publish yet! I need to add a web.config since we are running this PHP app on Windows.
Sendy on Windows - .htaccess vs. web.config URL rewrite
I noticed there's an .htaccess file in my Sendy install. That means they've likely got mod_rewrite stuff going on to make the URLs pretty. Here's their file:
ErrorDocument 404 "[404 error] If you're seeing this error after install, check this thread on our forum for the fix: http://sendy.co/forum/discussion/5/404-error-after-install/p1" Options +FollowSymLinks Options -Multiviews RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^([a-zA-Z0-9-]+)$ $1.php [L] # Link tracker RewriteRule ^l/([a-zA-Z0-9/]+)$ l.php?i=$1 [L] # Open tracker RewriteRule ^t/([a-zA-Z0-9/]+)$ t.php?i=$1 [L] # Web version RewriteRule ^w/([a-zA-Z0-9/]+)$ w.php?i=$1 [L] # unsubscribe RewriteRule ^unsubscribe/(.*)$ unsubscribe.php?i=$1 [L] # subscribe RewriteRule ^subscribe/(.*)$ subscribe.php?i=$1 [L]
Windows Azure Websites with PHP doesn't (yet?) support mod_rewrite so I have to make web.config that does the same thing with UrlRewrite. Fortunately importing mod_rewrite rules into web.config files has been straightforward for over 5 years in IIS.
Since I put Sendy in the root of a site, I don't have any sub-directories or paths. If it was in /sendy or something I might have to be a little more specific in my Regular Expressions below. You have to consider where Sendy is and where your web.config is. In this case, the easiest thing was the root and putting Sendy in its own site then adding this web.config. You'll notice is a pretty straight port.
I mentioned to the Azure Websites team that we should either directly support mod_rewrite or automatically turn existing ones into a format like this.
NOTE: This web.config is different, better, and much improved over the one that is mentioned on the Sendy Forums. It also works nicely and completely. The one on the forums is more than little iffy.
This web.config needs to be in the same folder as the Sendy app. I just made this file from WebMatrix directly.
Windows Azure Sendy Configuration
Next, change the includes/config.php and include the details on your application's location as well as your database connection details.
I chose to scale my site up to Shared mode so I could add a custom CNAME for the domain. I just went over to DNSimple where I host my DNS and added a CNAME for Hanselman.com that pointed to my fancypantsmail.azurewebsites.net site. Then in Azure I hit Manage Domains and added this new subdomain.
NOTE: The domain name that you tell the Sendy guys must be the same one that's in your config.php and the same one you run under. I bought it for hanselman.com so it will only run there. Phrased differently, I couldn't get Sendy to run until the CNAME subdomain resolved correctly.
Finishing Sendy Installation
The Getting Started checklist at Sendy is REALLY well written. Follow it carefully.
I hit my URL and tell Sendy about my license key. You'll know the app ISN'T installed correctly if you can't see any CSS or images or you get 404s. That means the web.config (my fake mod_rewrite) isn't there.
I skipped Step 4 of their Getting Started as I believe it's already done for me, even though I don't plan on uploading any files. I setup Amazon SES and verified my email addresses. Getting this right, as well as bounce and complaint handling is super important so read carefully.
You'll want to make sure your Amazon SES emails are verified, and that Sendy has endpoints setup for complaints and bounces.
Gotcha: I had to make sure both the SES and SNS were in Amazon East 1.
Once these endpoints are setup, again as the Getting Started checklist at Sendy explains, you're ready to do some tests.
Setting up a Newsletter Campaign
The Sendy application is really nice, easy to use and easy to move around in. I found it as easy as using TinyLetter, while it's clear there's more power underneath I have yet to tap into.
I was able to move my subscribers over with minimal trouble. I exported them from TinyLetter and imported them into Sendy. I wonder how long until the MySQL database gets big enough that I have to pay for it? Right now I'm still using the free MySQL database I created with my website.
Making a Subscribe Form
There isn't a Subscribe Form out of the box that I can find built-in to the Sendy app (can you?) so I made one at http://hanselman.com/newsletter that just posts to the Sendy API subscribe endpoint. Details here, it's just an HTTP POST! http://sendy.co/api. You can integrate it with whatever you like. I just made a simple form, myself.
Hopefully this will be a reasonable and economical solution for http://hanselman.com/newsletter for the foreseeable future!
* SOME DISCLAIMERS AND DETAILS: The Sendy links are a referral link, but they don't know me over at Sendy. I just like them. Maybe I'll get some soda money if you buy it. Also, note again that installing Sendy on Windows is explicitly not supported until they say it is. Don't bother those nice people with your Windows questions. I am assuming that you are reasonably technical and are willing to fiddle. I installed it on Azure because I've already got 12 sites at Azure. You might have success on a Linux machine at Amazon or at Linode. Good luck!
© 2013 Scott Hanselman. All rights reserved.