I was browsing Andy Budd’s bookmarklets page and thought the “Email URL” one was particularly interesting. Basically, all it does is bring up your default email program with the subject and body pre-populated with the current page title and URL, respectively, by using a “mailto:” link. Simple, but useful…
I had seen this done before on several pages, but never really thought about doing it for my own blog posts. I started by changing my ’single post’ template to include the JavaScript in Andy’s bookmarklet, but then I thought, “Why not use a few handy WordPress functions so it works even if JavaScript is disabled?”.
So, here is the simple, but effective, result:
<a href="mailto:?subject=<?php urlencode(the_title()) ?>&body=<?php urlencode(the_permalink()) ?>">Email this page</a>
You’ll notice that, now, all my posts have an ‘Email this page’ link below the title. Give the one on this page a click to check it out.
Update (05/13/07) - Although the solution described in this post still works well, I have opted to use Alex King’s ‘Share This’ plugin in its place. If you do not wish to implement all of the features offered in Alex’s plugin, the solution described in this post may work best for you.
Comments
Leave a Reply