Chile and RSS Feeds

So The Kid is in Chile. Nope. He didn't rush there upon news of an earthquake. He went the day before. Yeah, take that Red Cross.  

Needless to say he was surprised by the earthquake (no, sarcasm-intolerant reader, he didn't know that the quake was going to happen, ignore that first paragraph). However, sine he and others were there, they started the outreach and relief efforts pretty quickly. 

Understandably there were plenty of people back here wanting to know what was going on. Since The Kid knows I dig this internet stuff, he called me looking for some help. (As an aside, he called when I was in New York City at the drop.io headquarters hanging out when them, twilio, and other developers - see, he knew who to call.) 

The basic need was to relay reports via e-mail to those interested in staying up to date. 

Years ago I rewrote an e-mail list server that I originally wrote even more years ago. It somehow limps along. If you ever wondered why there are Twitter clients for every language, platform, and device around, but barely 5 e-mail discussion servers -- don't. Email is horrific. It's like FTP. Only not as old.

So setup a list on my aging list server. Arg. Yeah, doable. But pretty? Not so much. Not if you want to send photos. Video? I 'lol' in your face. 

But there are services out there - right? Someone does this - I now they do.

Enter posterous. No, I don't know how to pronounce it either. They take your lowly e-mail and turn it into a well formatted blog. Well, the content is well formatted, if you don't know how to clearly express yourself you're still out in the cold. But trust me, there are plenty of blogs like that - you'll fit right in.

So now we have a nice e-mail to blog conversion. Important because firing up the AJAX html editor on a phone probably isn't going to streamline the process. Yes, we've found what e-mail excels at, many clients, many platforms, dead simple to use. 

No, I don't know what FTP excels at. 

Those who want to follow a RSS feed, or check a site for updates are now covered. But what of those that want the updates e-mailed to them? Is there a blog to e-mail conversion? 

Of course there is. There are a ton of services, and posterous offers one internally. But - from what I could find - all of them are daily updates. Not real time. Not cool.

But wait. I have that e-mail list server limping along. I also have an rss feed. And from time to time I've been know to do this thing called 'programming'. Seems like this problem should be solvable - just grab the feed, and send the content as an e-mail. Oh, and probably should keep track of what has been sent. Don't want to resend e-mail every time we check the feed.

So a little while later, with a few lines of code connecting Zend_Mail to a SimpleXMLElement and we have it. A simple RSS to e-mail relay that e-mails the listserver new blog posts. But why is this better than sending updates to the posterous e-mail and the list e-mail? For a few reasons:

  • Blog posts can be added via the web interface and still be sent to the list.

  • The post converts all attached images to links, so HTML e-mail readers show the images without any attachments.

  • The e-mail's contain a link to the post online.

Not bad huh? If you're interested, here's the basic code

A more elegant solution would have been to setup a script to 'pose' as a blog, and use the posterous support of MetaWebLog to 'autopost' new content to the list. But that seems hard. And who wants hard?

Tim Lytle [03/10/10 08:54:25] | 0 Comments | Stream

Comments