One of the first things most people do when they get on the Internet is send an e-mail. Then you start surfing, finding pages to share, and can easily click a button to post to Facebook, Tweet, Pin, or +1 some content.

Why isn’t there an elegant way to e-mail a page?

E-Mail A WordPress Post Plugin

E-Mail A WordPress Post

I’ve been thinking about this, and came up with a solution, which you can see in the sharing options on this page (between the post title and content, and again at the end of the article). Using the mailto: href and the mailto URL scheme, with a click of a button you can create a new email message with the subject pre-populated with the post title, and the message body containing the post description and URL.

I’m using a Thesis hook for my social sharing block (explained here) and replaced StumbleUpon with an email option:

<a href="mailto:?subject=<?= urlencode(get_the_title($post->ID)) ?>&body=<?= urlencode(get_permalink($post->ID) . "\n" . get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true)) ?>" target="_blank"><img src="/wp-content/themes/thesis_18/custom/images/icon-email.png" width="59" height="20" border="0" alt="Email" /></a>

To get rid of “smart” quotes in the post title (e-mail subject), I also added

remove_filter('the_title', 'wptexturize');

No third party tools. No forms to fill out. Just click a button, and a user can email your page.

It’s the original sharing tool.


1 Comment » for E-Mail A Post WordPress Function
  1. WPBounce says:

    Once again. Genius things are simple.

Leave a Reply

Your email address will not be published. Required fields are marked *

*