Scott Hanselman

Installing Sendy (a PHP app) on Windows Azure to send inexpensive newsletter email via Amazon SES

March 19, '13 Comments [28] Posted in Azure | Web Services
Sponsored By

TL;DR Summary

  • 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 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 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 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:

Making a new website with a new MySQL DB

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.

Connection Strings and publish profile

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.

The Sendy PHP app opens nicely in WebMatrix

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:"

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.

<rule name="Sendy all" stopProcessing="true">
<match url="^([a-zA-Z0-9-]+)$" ignoreCase="true" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<action type="Rewrite" url="{R:1}.php" appendQueryString="true" />

<rule name="Sendy: link tracker" stopProcessing="true">
<match url="^l/([a-zA-Z0-9/]+)$" ignoreCase="true" />
<action type="Rewrite" url="l.php?i={R:1}" appendQueryString="true" />

<rule name="Sendy: open tracker" stopProcessing="true">
<match url="^t/([a-zA-Z0-9/]+)$" ignoreCase="true" />
<action type="Rewrite" url="t.php?i={R:1}" appendQueryString="true" />

<rule name="Sendy: web version" stopProcessing="true">
<match url="^w/([a-zA-Z0-9/]+)$" ignoreCase="true" />
<action type="Rewrite" url="w.php?i={R:1}" appendQueryString="true" />

<rule name="Sendy: unsubscribe" stopProcessing="true">
<match url="^unsubscribe/(.*)$" ignoreCase="true" />
<action type="Rewrite" url="unsubscribe.php?i={R:1}" appendQueryString="true" />

<rule name="Sendy: subscribe" stopProcessing="true">
<match url="^subscribe/([a-zA-Z0-9/]+)$" ignoreCase="true" />
<action type="Rewrite" url="subscribe.php?i={R:1}" appendQueryString="true" />

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.

    // Configuration
    //path to your Sendy installation (without the trailing slash)
    define('APP_PATH', '');
    //database connection credentials
    $dbHost = ''; //mySQL Hostname
    $dbUser = 'ladaladalada'; //mySQL Username
    $dbPass = 'pardypary'; //mySQL Password
    $dbName = 'sendyDBName'; //mySQL Database Name
    //$dbPort = 3306; //mySQL port (only if you need to change it)
    //domain of cookie (99.99% chance you don't need to edit this)
    define('COOKIE_DOMAIN', '');

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 that pointed to my 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 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 that just posts to the Sendy API subscribe endpoint. Details here, it's just an HTTP POST! You can integrate it with whatever you like. I just made a simple form, myself.

Sending mails!

Hopefully this will be a reasonable and economical solution for 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!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselman's Newsletter of Wonderful Things: February 26th, 2013

March 14, '13 Comments [10] Posted in Newsletter
Sponsored By

I have a "whenever I get around to doing it" Newsletter of Wonderful Things. Why a newsletter? I dunno. It seems more personal somehow. Fight me.

Still, it's one more site to check and it's a hassle for some of you  Dear Readers. Therefore, I will still do the newsletter, but I'll post each newsletter to the blog some weeks later.

You can view all the previous newsletters here. You can sign up here Newsletter of Wonderful Things or just wait and get them later on the blog, which hopefully you have subscribed to.

Here's the LAST newsletter, delay-posted as I do.

Hi Interfriends,

Thanks again for signing up for this experiment. Here's some interesting things I've come upon this week. If you forwarded this (or if it was forwarded to you) a reminder, you signed up at and the archive of all previous Newsletters is here.

Scott Hanselman

(BTW, since you *love* email you can subscribe to my blog via email here: DO IT!)

P.P.S. You know you can forward this to your friends, right?

Sponsor: Thanks to Red Gate for sponsoring this week's feed. Free eBook – 50 ASP.NET & SQL Server performance tips from the dev community, to help you avoid, find, and fix performance issues in your ASP.NET app. Download it from

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Technology fails in film are the new Wilhelm Scream

March 12, '13 Comments [103] Posted in Musings
Sponsored By

Internal IP address PLUS Google Earth equals National SecurityThere's no other explanation. It must be a tradition like the Wilhelm scream.

What, haven't heard of the Wilhelm scream? Well, once you do it's impossible to not hear it in every film. It's in freaking Lord of the Rings, and it grates. It's THE go-to person screaming sound effect and has been for over 50 years. Here's a compilation of dozens of movies - including every George Lucas movie - that uses the Wilhelm scream.

Hollywood and TV seems determined to make the technology-aware jump up from their seats and scream NO!!! at the screen.

I can only imagine what a doctor or nurse must feel like when watching ER or a dramatic surgery.

A technical error pulls me out of the story like a slap in the face. It almost physically hurts. I'm not just nitpicking here, either. These aren't hard things to fix. One just needs to care.

Now, often they'll use internal IP addresses to represent external addresses and a lot of folks argue that using these addresses is the "555 Phone Number" equivalent. I can see that a little, but even if they used the IP Address of the studio it wouldn't be so jarring.

It's debatable who is worse between TV and Movies, but it's clear that CSI has the #1 spot locked down with this classic.

GUI interface in Visual Basic

This is so cringe-worthy, it's legendary.

Jurassic Park It's a Unix System

I wish all my file systems were in 3D. This was actually a real UI that you could use. Bummer that ls -alogF isn't as photogenic.

Bing it? Hawaii Five-0

Bad product placement (IMHO) is becoming a problem on TV as well. While this isn't inaccurate, the cheese-factor here is high.

Red Dwarf UNCROP

I personally love this video and while it's techno-nonsense today, I'm sure the next version of Photoshop will have this feature. Those guys are amazing.

The Net Hacking

What can I say about this other than I am nostalgic for 3.5" floppies.

Hackers Script

I have to admit that I love Hackers and it's amazing to watch a young Angelina Jolie and Jonny Lee Miller. You can read the script online. Nearly every technical detail is sketchy, though.



I found SkyFall to be very entertaining. The folks at io9 have a nice post on the hacking scenes. I love this;

" one point Q exclaims, "It's security through obscurity!" as if this is the most elite thing a hacker could ever do."

Sigh. Wouldn't it be great if a movie producer reached out to us to help?


NCIS - Hacking Gamers

Oh, CBS.

SwordFish - Giant Monitors

Most of my great hacking moments include 6 monitors on arms, dancing and a dynamic montage, don't yours?

Swordfish Giant Monitors

NCIS - Two Idiots and One Keyboard

NCIS keeps bringing the hits with a keyboard maneuver that needs to be seen to be believed. "I'll just ASDF and you can JKLsem, ok?"

Chloe, open a socket

Chloe from 24 is always asked by Jack to "open a socket." There's a lot of questions on the net wondering what this cryptic tech-speak means: Can someone tell me what a "socket" is? "24" NO Spoliers [sic]!

There's even a band called Chloe's Open Socket. Awesome.

Chloe Open a Socket


Want to know what it's like to hack like SwordFish? Visit ;)


Here's not one, but two classics from Antitrust.


The Matrix

Sometimes I need to just re-watch the nmap hack in The Matrix to cleanse myself. It was so refreshing to see real commands and a real hack in a movie that we already respected for it's attention to detail.

Sadly, this hack is now the go-to hack for movies that care enough to steal their hack but don't care enough to research their a new one.

The Matrix nmap hack

What's your favorite horrible technology FAIL in film or TV?

Do you think that all this is being done a purpose, like the Wilhelm Scream?

Sponsor: Thanks to Red Gate for sponsoring this week's feed. Free eBook – 50 ASP.NET & SQL Server performance tips from the dev community, to help you avoid, find, and fix performance issues in your ASP.NET app. Download it from

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Our first year. A new web conference - <anglebrackets>

March 8, '13 Comments [22] Posted in HTML5 | Programming | Speaking | Web Services
Sponsored By

anglebrackets conferenceThere's a new web conference happening in Vegas next month and you should join us. John Papa, myself and our friends pulled in the speakers from a combination of invitations and submitted talks. It's called and I hope to see you there.

My friends and I miss the old Mix conference and the great fun of web conferences in Vegas generally. So we talked to Richard Campbell and some friends and made our own show. (This is not a Microsoft show, to be clear)

This is the first year of anglebrackets and it's going to be a small conference and we have no money. Because of this, we are co-located with a larger conference* and attendees can move between the two conferences.

You'll be able to enjoy web-focused, back-end non-specific web sessions from amazing web people like:

  • Lea Verou - Developer Relations at the @W3C
  • Christian Heilmann - Mozilla
  • Jonathan Snook - Author
  • Elijah Manor - jQuery expert
  • Jim Cowart - appendTo()
  • Denise Jacobs - Creativity Evangelist
  • Phil Haack - GitHub
  • Scott Hanselman (me) - Web guy
  • and more!

We've got killer sessions like:

  • The Vanilla Web Diet
  • Modern JavaScript Development
  • Hands On Responsive Design with Twitter Bootstrap
  • Rich Data HTML Apps with Breeze
  • Getting Started with Require.js
  • TML5 Canvas and Kinetic.js
  • Eventing and Messaging in JavaScript
  • plus talks on SignalR, ASP.NET, PHP, Backbone, CSS, JavaScript Patterns, Gamifying your work, and lots more.

AUqYiSFK3v_1_1303867939All this and a special keynote from Mozilla Web Guy Christian Heilmann!

This conference will be a great way for you to get up to date on the modern web but also check out some of the DevIntersection talks on ASP.NET, Architecture, Elastic Scale in the cloud and more.

We're lean and mean and independent and we hope you join our first year.

If you register for the show package or complete package you'll also get your choice of a Google Nexus 7 or a Microsoft Surface RT.

There's also some excellent pre- and post-conference workshops you should consider enrolling in:

  • April 8th
    • Day of Single Page Applications - John Papa, SPA and JavaScript expert
    • On the Metal: Essential HTML5, CSS3 and JavaScript for All Developers (Bring your laptop!) - Todd Anglin, Telerik
    • Hacking the Creative Brain: Work Better, Produce More - Denise Jacobs, a TEDx speaker, Creativity Evangelist, and author of CSS Detective
    • Nimble and fast web apps for the mobile web - Christian Heilmann, Mozilla
  • April 12th
    • Building Applications with ASP.NET MVC 4 - K. Scott Allen, Author, Trainer and Consultant
    • User Experience Design for Non-Designers: An Interactive, Immersive Workshop - Billy Hollis, UX and App expert

The Complete Package includes TWO workshops plus the tablet, and the Show Package includes one workshop and the tablet, or just come to the main conference itself.

See you there!

* Yes, we took a little artistic license with the <tag/>, or <tag />, or <tag> if you are super pedantic. It is valid syntax although HTML5's opinion is different than XHTML's. The fact that you even noticed and want to argue is proof you should come to this conference. See what I did there?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Programming's not for you? How about thinking? Be empowered.

March 4, '13 Comments [37] Posted in Musings | Programming
Sponsored By

Used under CC via seems to be two extremes of this whole "Learn to Code" movement which has come to a crescendo with the "What most schools don't teach" video from

People seem to fall on the side of "Everyone should learn to code! Teach the babies Common Lisp!" or "Not everyone can be a programmer! Relax!"

Surely we can ALL agree that this discussion isn't about code at all. "Code" is just a convenient and press-friendly way to say "think in algorithms, think about problems, think about how things fit together."

It seems a little disingenuous to focus so much on teaching first graders to code or third graders about robots while simultaneously shuttering music, art and drama programs. Our expectations of our students when it comes to math, with some suggesting we stop teaching algebra.

We need to teach kids to think and to be excited about thinking.

Code should be taught - in age appropriate ways - as part of a larger "solving problems" curriculum.

Thinking should be cool.

Why is everyone trying to get everyone else to code? One word: Empowerment. Code represents power. The power to create, the power to change, the power to influence. Code also represents money to many. It is a raw representation of both intellect and instinctually property.

But woodworking, art, sculpture, drama and music are all ways to create and influence. They just don't have price tags as impressive.

There's clearly a Digital Divide and it's bigger than just blue collar and white collar workers. It's as big as the STEM (science technology engineering math) divide. Are you a computer person? Or not?

A family friend almost lost their domain a few months back. Had they lost it, it would have decimated their whole non-technical business. It was extremely confusing for them to tease out the difference between who owned the domain and held it, who hosted the DNS and who hosted the site. In their case, GoDaddy controlled it ALL and they got locked out of everything. An hour of whiteboarding and some moving things around got them setup at DNSimple and SquareSpace and put them in control of the tech they cared about.

I hate to see small businesses being charged thousands for things they could easily do themselves.
- Said the Software Engineer who hired a guy to fix his toilet.

How/when could they have learned this incantation? In school? on TV? Or should they have puzzled it out themselves? How far should it go?

Learn the Basics. If you're excited, learn more.

Learning to code, to me, is no different from me having someone teach me basic woodworking, gardening, or kitchen tile. After each of these projects my sense of personal empowerment increased. In each situation learned how to think about a problem and solve it. I can do this. I can change my world.

Take a minute and read 101 Basic Homesteading Skills. I came out knowing about 9 of these, thereby ensuring my quick death in the coming Zombie Apocalypse.  There's a great video of Mike Rowe about how many 'dirty jobs' are available but folks either lack the skills or interest to do them.

We should learn a little of everything and a lot about the essentials. Is learning to code essential? No, not yet. but learning to think about abstractions is.

Maybe you won't be able to create swim lane overlay graphics entirely in CSS3 but you should hopefully get the gist and be excited about how freaking cool it is.

Reading, Writing, Arithmetic, and Algorithms

But perhaps it is time for "Reading, Writing, Arithmetic, and Algorithms" in school. For loops, while loops. I love this idea on "How to train your robot. The parents are the robots and the kids give them a list of instructions (a "program") to accomplish a simple task. A kinesthetic and tactile way to teach a young kid to think without staring at a screen. Read more about this at OffBeatFamilies and get the materials at Dr. Techniko's blog.

Image borried from OFFBEATFAMILIES. Read their article and love them!

Procedural and Functional thinking, as well as other concepts like Project Management and Time Management are essential components of an empowered individual. These are teaching people to think. Teach them a little code and a little music and a little art, then nurture their excitement and try to turn it into empowerment. Everyone should get a chance and be exposed to all of this.

At the very least, I'd love for everyone to come out of high school with enough math/science/technology be able to wallow in the magic and wonder of the greatest joke ever (origin unknown). ;)

An engineer walks into a bar and orders 1.0E20 root beers.
Bartender: "That's a root beer float."
Engineer: "Make it a double."

I'm still giggling at this one, years later.

What do you think?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.