Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

Attach current url of the page with mailto() tag



6:20 pm on Oct 20, 2004 (gmt 0)

10+ Year Member

Greetings all,

I've been trying to solve a problem I have with attaching the url of a current page into the body of an e-mail.

I wish to trigger the mail program (default) with the mailto tag when a user is sending the page to a friend.

It would look something like this I think:

<a href="mailto:someone@somedomain.com?subject=my%20subject&body=http://the url of this page">mail this link to a friend</a>

I appreciate any suggestions
thx zr


8:58 pm on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member


<a href="mailto:someone@somedomain.com?subject=my%20subject&body=http://mydomain.com/thispage.html">mail this link to a friend</a>


<script ... >
document.write('<a href="mailto:someone@somedomain.com?subject=my%20subject&body='+top.location.href+'">mail this link to a friend</a>');


<a href="mailto:someone@somedomain.com?subject=my%20subject&body=http://<?=$HTTP_HOST.$PHP_SELF?>">mail this link to a friend</a>


11:13 pm on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You need to grab the url of the current page with Javascript on the client-side or a server-side script of some kind. Either that, or hand code it into each page. Then there is also the issue of how the recipient's email address gets into the mesaage and whether you want a record of that or not.

Because there is no pure HTML solution, I'd suggest working out this issue in our Javascript forum, or our either one of our PHP forum / Perl CGI script forums for a server side answer.

Also, there are many free scripts available around the web to help you do this - so you don't need to start from scratch. Try a Google search on email friend script or a related search phrase that includes the scripting technology you want to use.


11:12 am on Oct 21, 2004 (gmt 0)

10+ Year Member

Thanks guys,

I'll try it and come back to you..!



Featured Threads

Hot Threads This Week

Hot Threads This Month