Filling in the email FROM & Body on click

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AbrasiveRock
Forum Commoner
Posts: 40
Joined: Sat Feb 08, 2003 10:47 pm
Location: Olympia,WA
Contact:

Filling in the email FROM & Body on click

Post by AbrasiveRock »

Ok, I have been searching everywhere (including the search feature here) to figure out this very simple task.

When people click a link, I want it to open up their email client with their email address in the From spot. I want the message body to be the url that the link was clicked.

EDIT: The part I can't figure out is how to make it detect the url the link was clicked from.

In the end it should be something that can be placed in a sever side include. This is why I am trying to get it to detect what url it was clicked from. I found the script once, but can't remember where.
Last edited by AbrasiveRock on Sat Aug 07, 2004 2:43 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

<a href="mailto:whatever@yoursite.com?subject=urlencoded_subject&message=urlencoded_message">click me!</a>
I think... might be body=blah
AbrasiveRock
Forum Commoner
Posts: 40
Joined: Sat Feb 08, 2003 10:47 pm
Location: Olympia,WA
Contact:

Post by AbrasiveRock »

Ok, what I have so far is...

Code: Select all

<A HREF="mailto:?subject=Check this website out!&body=This_Is_The_Part_That_I_Want_To_Detect_The_URL_The_Link_Was_Clicked_From">Send This Page To A Friend</A><P>
So I have everything except making the body list the URL is was clicked from.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

<?php

echo '<a href="mailto:?subject=' . urlencode($subject) . '&body=' . urlencode($_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] . $_SERVER['REQUEST_STRING']) . '">Send this page to a friend</a>';

?>
note: most sites have an in-site form that the user fills out to email it, so the site can add any extra details and markings with better ease. Generally with a custom message the sender can add, if they'd like.
Post Reply