WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] "Mail to a friend" html code (4 posts)

  1. Kadr
    Member
    Posted 3 years ago #

    Hey,

    I'd like to know what kind of code snippet I can add to a post so that users can send the article to a friend.

    Ideally the link should open the default mail program, create a new message with an empty address field, but with the name of the blog entry in the subject field and a link to the article in the body.

    Thnx for any help on this!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try:

    <a href="mailto:blank?subject=<?php the_title(); ?>&body=I thought you might be interested in <?php the_title(); ?>. You can view it at: <?php the_permalink() ?>">Send to a friend</a>

  3. Kadr
    Member
    Posted 3 years ago #

    works like a charm!
    Thanks very much!

  4. xiabolai
    Member
    Posted 3 years ago #

    hi, i think this is related to the above question. i'm using this code...

    $out .= "<br />". __("Send a thanks to","wp-greet")." </th><td>". $res->fromname . " <" . $res->frommail . ">";

    ...to display the following message:

    Send a thanks to Name <email@domain.com>

    my problem is, i don't know how to turn the <email@domain.com> into a link so that when clicked it launches an email client and sets it as the "to" field, much like mailto: would do.

    is this possible? any hints would be appreciated.

    thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic