Post Pic

WordPress tip: Send article to a friend by email

In order to create more traffic on your blog, it can be a good idea to let your readers send your posts to their friends by email. A few month ago, I already shown you a function to do that, here is an improved version for today.

To apply this recipe to your blog, simply paste the following function into your functions.php file, and that's all. Hard to do something simpler!

function direct_email($text="Send by email"){
        global $post;
        $title = htmlspecialchars($post->post_title);
        $subject = 'Sur '.htmlspecialchars(get_bloginfo('name')).' : '.$title;
        $body = 'I recommend this page : '.$title.'. You can read it on : '.get_permalink($post->ID);
        $link = '<a rel="nofollow" href="mailto:?subject='.rawurlencode($subject).'&amp;body='.rawurlencode($body).'" title="'.$text.' : '.$title.'">'.$text.'</a>';
        return $link;
}

Thanks to : WebInventif.fr for the awesome trick!

Also, I got some exiting news for you : First, Chris Coyier and Jeff Starr just released their first ebook, called "Dig into WordPress". I recommend you to have a look at it!

Second, I have some great WordPress related domain names for sale:
wpdoc.com : Stands for both "WordPress Doctor" or "WordPress Documentation". DEFINITELY a great opportunity if you're looking to start your own WOrdPress related site or business. Price is $25.

wpplr.com : Stands for WordPress Private Label Right. Wonderful opportunity if you're looking to create and release PLR WordPress themes! Price is only $15!

wp3k.com : Stands for WordPress 3000. I only ask $15 for this 4 characters domain.

If you want one of them, simply send me an email. First come, first served, so be quick!

9 Responses

Nov 13 2009 20:15

Using a mailto link is fine, but I think a pop-up form is much more useful.

We use addthis.com – about 40% of our shares are via email, 40% via facebook, the rest are twitter, stumble, delicious, etc.

Nov 14 2009 18:45

Dear Jean-Baptiste Jung
Thanks for that tip.
Before I am using it I’d like to share with all of you my dilema considering copied contents. Dew to my bad experience sending an artticle via mail might make it easy to be copied.

Nov 15 2009 01:01

How do you call the link? I tried playing with the code in my single.php, but kept getting errors.

Nov 16 2009 21:54

I am going to guess you call <?php direct_email(); ?>

Nov 18 2009 16:37

The function call is: as mentioned by the original author. Would be nice if you guys had posted it here as well. This is just a half finished recipe :-(

Nov 18 2009 16:38

Sorry code was striped out:

<?php echo direct_email(); ?>

Dec 09 2009 15:57

Thanks for the php line Michael! Otherwise was useless.

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required