[SOLVED] - Insert URL in mailto:body

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
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED] - Insert URL in mailto:body

Post by anjanesh »

Code: Select all

echo '
<A HREF="mailto:user@domain.com?subject=link&body=index.php?'.$_SERVER['QUERY_STRING'].'" </A>
';
The url has many get parameters.
This obviously stops on getting a variable other than subject and body.
Having $_SERVER['QUERY_STRING'] in single quotes doesnt work either.
How do I insert the url in body ?
Last edited by anjanesh on Sat Sep 04, 2004 10:20 pm, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Code: Select all

HREF="mailto:user@domain.com?subject=link&body=index.php&'.$_SERVER&#1111;'QUERY_STRING'].
mind the & after index.php instead of the ?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

url encode the entire url you want in the body.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Yes Feyd. got the url in body to work - $url=htmlentities(urlencode($url));
Is there a method have this done (using onClick instead of A HREF). ?
<TD onClick="mailto:whatever">
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

sure..

Code: Select all

document.location.href = 'mailto:blahblahblah';
don't rely on javascript being on though ;)
Post Reply