Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forwarding an HTML Page to an email address

    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>?>??

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Will you be collecting the addresses to use for marketing or do you not need to save them?

  • #3
    Regular Coder Coastal Web's Avatar
    Join Date
    Oct 2004
    Posts
    225
    Thanks
    12
    Thanked 3 Times in 3 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •