Created
March 8, 2012 00:56
-
-
Save justinwhall/1997673 to your computer and use it in GitHub Desktop.
PHP: Function e-mail share
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//email share function | |
function direct_email($text="Send by email"){ | |
global $post; | |
$title = htmlspecialchars($post->post_title); | |
$excerpt = htmlspecialchars($post->the_excerpt); | |
$subject = 'Article by '.htmlspecialchars(get_bloginfo('name')).': '.$title . $excerpt; | |
$body = 'Check out this article from Justin W Hall: '.$title. "\n" . "\n" .get_permalink($post->ID); | |
$link = '<a rel="nofollow" href="mailto:?subject='.rawurlencode($subject).'&body='.rawurlencode($body).'" title="'.$text.' : '.$title.'">'.$text.'</a>'; | |
return $link; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment