TechBrew

Informative geekery on software and technology

RESTful Spam Mashup: Get Throw-Away Email in an RSS Feed

August 29th, 2007 by Mark Woodman

There are a variety of temporary email services out there in internetland, perfect for signing up at websites where you need the goods but are distrustful of the privacy policy. The ironic problem with many of these services is that you have to create an account and use your real email address.

One nifty alternative is Spam.la, a service of DreamHost that allows you to use any email address ending with @spam.la. Just pick a username to use as a throw-away email address, and any messages sent to that address will appear right on the Spam.la homepage. (The spam is coming in fast-and-furious, so you can filter the results based on your username.)

spamrss.jpgThe disadvantage of this setup, of course, is that literally anyone can read your messages if they’re trolling the homepage. For many situations, however, that doesn’t much matter. The other disadvantage is that you have to constantly visit the site to see if any email has arrived. They don’t offer an RSS feed, so I thought I’d do a little mashup with some RESTful services and make an RSS feed of my own.

If you don’t care about how it works, just read “The Short Story” below, copy and edit the link, and you’ve got an RSS feed ready to go.

The Short Story

If your temporary email address is “bobby@spam.la”, this link will provide an RSS feed of your Spam.la email messages:

http://www.w3.org/2000/06/webdata/xslt ?xslfile=http%3A%2F%2Ftechbrewfiles.googlepages.com%2Fspamla.xsl &xmlfile=http%3A%2F%2Fcgi.w3.org%2Fcgi-bin%2Ftidy%3FdocAddr%3D http%253A%252F%252Fspam.la%252F%253Ff%253Dbobby%26forceXML%3Don

Since you probably aren’t using ‘bobby@spam.la’, just replace ‘bobby‘ in the URL above with your email name, and you’re ready to subscribe to it with an RSS reader. (Be sure to right-click and copy the link location, rather than cut-n-paste the above text. The display text has spaces to allow for line breaks.)

If you want to know how this works, keep reading.

The Long Story

The Spam.la webpage is very basic HTML. When you filter based on an email address, the URL starts like this:

http://spam.la/?f=bobby

The HTML isn’t well-formed, so we can’t treat it like XML just yet. As is, there’s not much we can do with it without writing a bunch of string parsing code. But thanks to the availability of some handy RESTful services on the web, we can transform it into RSS in a couple of passes. Here’s how:

1) Tidy up the HTML into XHTML with the free W3C Tidy parser service, checking “enforce XML well-formedness” to make sure it is ready to use. Passed into the parser, the XHTML of the filtered spam page is now:

http://cgi.w3.org/cgi-bin/tidy? docAddr=http%3A%2F%2Fspam.la%2F%3Ff%3Dbobby &forceXML=on

2) Employ an XSL stylesheet to turn the email links in the XHTML into RSS items. I wrote one and put it here: http://techbrewfiles.googlepages.com/spamla.xsl .

It is free to use and modify under a LGPL Creative Commons license.

3) Use the W3C XSLT Servlet service to transform the XHTML with the above stylesheet. This is also a REST service, so the result is a long URL that contains the tidy Spam.la page and the XSL stylesheet. It is uglified with URL encoding, but it works:

http://www.w3.org/2000/06/webdata/xslt ?xslfile=http%3A%2F%2Ftechbrewfiles.googlepages.com%2Fspamla.xsl &xmlfile=http%3A%2F%2Fcgi.w3.org%2Fcgi-bin%2Ftidy%3FdocAddr%3D http%253A%252F%252Fspam.la%252F%253Ff%253Dbobby%26forceXML%3Don

Voila! You have throw-away anonymous email where your RSS reader is your inbox. Just edit ‘bobby’ with the username of your choice, and you’re done.

If you found this handy or have improvements, please leave a comment or contact us.

Trackback URI | Tags: Feeds · How-To

0 responses so far ↓

  • No comments yet... be the first!

Leave a Comment