...

View Full Version : Forwarding an HTML Page to an email address



kona72
05-28-2005, 09:15 PM
I have been searching for some code that will allow a visitor to forward the page they are visiting to another person via thier email client. ANy ideas>?>??

syrupcore
05-29-2005, 12:29 AM
Will you be collecting the addresses to use for marketing or do you not need to save them?

Coastal Web
05-29-2005, 10:34 PM
Well you're going to be pretty limited with *just* HTML but this would work...

<form action="mailto:joeslime@hotmail.com" method="GET">
<input type="hidden" name="subject" value="Check_out_this_page!">
<input type="hidden" name="body" value="http://www.mypage.com">
<input type="submit" value="SEND THIS PAGE TO A FRIEND!!">
</form>

My suggestion however is to try something with PHP, which would look like so (which is tested, and works):

<?php
###################
# form was submitted
if(isSet($_POST['submit'])){

$mail_to = $_POST['mail_to'];
$friend = $_POST['friend'];

$mail_subject = "You've got to see this page!";
$mail_message = "Your friend "+friend+" thinks you should check out this page for some reason: http://www.yoursite.com";
$mail_from = $friend+"@yoursite.com";

$mail_cc = "";
$mailsend = mail("$mail_to", "$mail_subject", "$mail_message", "From: $mail_from\r\ncc:$mail_cc\r\nContent-type:text/plain");

echo <<<endHTML

<html><body>
Thank you $friend, youre message has been sent to $mail_to...
<br>
You are now being redirected.
<META HTTP-EQUIV=Refresh CONTENT="3; URL=$PHP_SELF">
</body></html>

endHTML;
exti;

}else{
#######################
# form was not submitted, lets show it.
echo <<<endHTML

<html>
<body>
<form name="mailer" method="POST" action="$PHP_SELF">
Your Name: <input type="text" name="friend" value=""><br>
Friends Email Address: <input type="text" name="mail_to" value=""><br>
<input type="submit" name="submit" value="SEND THIS PAGE!">
</form>

endHTML;
}
?>

any questions feel free to ask,
Samantha Gram



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum