code for send this page to a friend button

sledge
sledge used Ask the Experts™
on
I have a web site where i want a button that will send the page to an e-mail address when clicked.
A bit like outlook express with the new message using web page function, but automatically.
I've seen it on web pages. you click on the button, and it asks you for the e-mail address you want to send the page to, or opens up your e-mail client. The reciever gets that web page in an e-mail.

what code do i need on my website for that button function?

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Don't talk to me.
Commented:
Hi sledge,

You are actually asking about two different types of things.

When the user clicks a button or link and it opens the mailer, that's one thing and it can be done with javascript.  Here's a link to a good one:

http://javascript.internet.com/page-details/send-this-page.html

However, you can also make it very complicated by using a server-side script to process the page in some way and attach the HTML page to an email.  That's a whole other ball of wax, though.
jason1178 is completely right, but it doesn't nessasarily have to be in javascript...

Just a basic HTML link with "mailto:" will work as per http://email.about.com/od/mailtoemaillinks/a/mailto_elements.htm

<a href="mailto:?body=Take a look at this page I found at: http://google.com">Click Here</a>
Jason C. LevineDon't talk to me.

Commented:
Matt is right also.  The javascript I put up there is just a really fancy way of using mailto: the way he shows it.  
QPR
Commented:
A simple ASP solution I use all over the site has 4 form fields (you can cut down if wish)
Your name, your email, friends name, friends email.
You click any link around the site to arrive at this "send an email" page.
Below is the code for the page that processes the form (4 text fields).
It also finds out which page you came from so that it can build the link to put in the email (means you can use the same process on many pages within the site).

<%
name1 = request.form("name1")
name2 = request.form("name2")
email1 = request.form("email1")
email2 = request.form("email2")
item = request.form("item")
CallingPage = request.form("CallingPage")
theMessage = "Hi " & name2 & "<br />I invite you to take a look at this page on this awesome web site"
theMessage = theMessage & " <a href=""" & CallingPage & """>" & item & "</a><br />"& name1 & "<P>" & email1
set objMail = Server.CreateObject("CDONTS.NewMail")
with objMail
      .To = email2
      .From = "you@yourdomain.com"
      .Subject = "Site invite"
      .body = theMessage
      .BodyFormat = 0
      .MailFormat = 0
      .Send
end with
set objMail = nothing
%>

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial