E-Mail A Post WordPress Function
I may earn money or products from the companies mentioned in this post.
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?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.
<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
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.