Friday, November 23, 2007

Added a 'Mail This' feature

I just implemented a simple 'Mail This' feature in about 10 minutes. Instead of setting up a fancy form that could be exploited by spammers I opted for the reliable old mailto: link. It ends up that you don't need a email address in the link, and that you can fill in the subject and body easily.

For example, the mailto: link for A Christmas Story looks like this:

mailto:?subject=MovieLandmarks.com%20-%20A%20Christmas%20Story%20&body=Check%20out%20this%20MovieLandmarks.com%20location%3A%20http%3A//www.movielandmarks.com/%23movie-B0000AYJUW%0A%0AMovieLandmarks%20is%20a%20movie%20and%20TV%20location%20search%20engine.%0A%0A

You simply pass it a ?subject= and a &body filled with the relevant location and link information. This way the email comes directly from the person, not from an intermediate server, spammers can't exploit the feature to send their crap under your name, and the message is more personal.

Make sure the contents of the subject and body are escaped using the javascript escape() function so that things like quotes won't mess up the link.

No comments: