Need Help With Email Form Setup

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BannerDept
    Confirmed User
    • Apr 2006
    • 511

    #1

    Need Help With Email Form Setup

    Looking for links/tutorials on setting up an email form on my website, that allows people to fill in their subject, email address, message and submit it to me...using my email server.

    Any help would be greatly appreciated. Thanks.

    ICQ: 106-293
    Summer Design Specials!
  • BannerDept
    Confirmed User
    • Apr 2006
    • 511

    #2
    bump bump bump

    ICQ: 106-293
    Summer Design Specials!

    Comment

    • SmokeyTheBear
      ►SouthOfHeaven
      • Jun 2004
      • 28609

      #3
      save this as email.php then go to it..

      Code:
          <?php
          $fileLocation = $HTTP_SERVER_VARS["PHP_SELF"];
          $fileName = basename ($fileLocation);
      
          $notcomplete = false;
          $nodata = false;
      
          if ( !isset($_POST["mailto"]) ) {
             $nodata = true;
          }
          if ( !isset($_POST["subject"]) ){
             $nodata = true;
          }
          if ( !isset($_POST["email"]) ){
             $nodata = true;
          }
          if ( !isset($_POST["name"]) ){
             $nodata = true;
          }
          if ( !isset($_POST["message"]) ){
             $nodata = true;
          }
      
          if ($nodata){
          ?>
      <center><h1>Anonymail</h1>
          <form action="<?=$fileName?>" method=hahahahahaha>
          <table border="0" cellpadding="0" cellspacing="0"><tr><td>
          Name:<br><input type="text" value="Your Name" name="name" size="20"><br>
          Email:<br><input type="text" value="[email protected]" name="email" size="20"><br>
          Subject:<br><input type="text" value="Your Subject" name="subject" size="20"><br>
          Send to:<br><input type="text" value="[email protected]" name="mailto" size="20"><br>
          Message:<br><textarea name="message" cols="30" rows="6"></textarea><br>
          <input type="submit" name="submit" value=" Send "></td></tr></table></form>
          <?php
            exit("");
          }//end if nodata
      
          if ( trim($_POST["mailto"] hahahaha "") ){
             $notcomplete = true;
          }
          if ( trim($_POST["subject"] hahahaha "") ){
             $notcomplete = true;
          }
          if ( trim($_POST["email"] hahahaha "") ){
             $notcomplete = true;
          }
          if ( trim($_POST["name"] hahahaha "") ){
             $notcomplete = true;
          }
          if ( trim($_POST["message"] hahahaha "") ){
             $notcomplete = true;
          }
      
          if ($notcomplete){
               echo "missing required parameter";
               //you could change the a
               exit ('a href="javascript:history.back(1)"> click here a');
          }
          $mailto = $_POST["mailto"];
          $email = $_POST["email"];
          $subject = $_POST["subject"];
          $message = $_POST["message"];
          $name = $_POST["name"];
      
          //$mailto = "$mailto";
          //$subject = "$subject";
          $msg = ereg_replace("\\\'", "'", $message);
          $msg1 = ereg_replace('\\\"', "\"", $msg);
          $message1 = "From: $name\nemail: $email\nmessage:\n$msg1";
          $sent = mail($mailto, $subject, $msg, "From: $email\r\nReply-to: $email\r\n");
          if ($sent){
               echo ("Your Email has been sent to $mailto!");
          }else{
               echo "Message sending Failed";
          }
      
          ?>
      hatisblack at yahoo.com

      Comment

      • SmokeyTheBear
        ►SouthOfHeaven
        • Jun 2004
        • 28609

        #4
        gfy fucks up the code

        where it says hahaha the first time should say post

        then the rest of the hahaha's should read ==
        hatisblack at yahoo.com

        Comment

        • SmokeyTheBear
          ►SouthOfHeaven
          • Jun 2004
          • 28609

          #5
          Code:
              <?php
              $fileLocation = $HTTP_SERVER_VARS["PHP_SELF"];
              $fileName = basename ($fileLocation);
          
              $notcomplete = false;
              $nodata = false;
          
              if ( !isset($_POST["mailto"]) ) {
                 $nodata = true;
              }
              if ( !isset($_POST["subject"]) ){
                 $nodata = true;
              }
              if ( !isset($_POST["email"]) ){
                 $nodata = true;
              }
              if ( !isset($_POST["name"]) ){
                 $nodata = true;
              }
              if ( !isset($_POST["message"]) ){
                 $nodata = true;
              }
          
              if ($nodata){
              ?>
          <center><h1>Anonymail</h1>
              <form action="<?=$fileName?>" method="[b]post[/b]">
              <table border="0" cellpadding="0" cellspacing="0"><tr><td>
              Name:<br><input type="text" value="Your Name" name="name" size="20"><br>
              Email:<br><input type="text" value="[email protected]" name="email" size="20"><br>
              Subject:<br><input type="text" value="Your Subject" name="subject" size="20"><br>
              Send to:<br><input type="text" value="[email protected]" name="mailto" size="20"><br>
              Message:<br><textarea name="message" cols="30" rows="6"></textarea><br>
              <input type="submit" name="submit" value=" Send "></td></tr></table></form>
              <?php
                exit("");
              }//end if nodata
          
              if ( trim($_POST["mailto"] [b]=[/b][b]=[/b] "") ){
                 $notcomplete = true;
              }
              if ( trim($_POST["subject"] [b]=[/b][b]=[/b] "") ){
                 $notcomplete = true;
              }
              if ( trim($_POST["email"] [b]=[/b][b]=[/b] "") ){
                 $notcomplete = true;
              }
              if ( trim($_POST["name"] [b]=[/b][b]=[/b] "") ){
                 $notcomplete = true;
              }
              if ( trim($_POST["message"] [b]=[/b][b]=[/b] "") ){
                 $notcomplete = true;
              }
          
              if ($notcomplete){
                   echo "missing required parameter";
                   //you could change the a
                   exit ('a href="javascript:history.back(1)"> click here a');
              }
              $mailto = $_POST["mailto"];
              $email = $_POST["email"];
              $subject = $_POST["subject"];
              $message = $_POST["message"];
              $name = $_POST["name"];
          
              //$mailto = "$mailto";
              //$subject = "$subject";
              $msg = ereg_replace("\\\'", "'", $message);
              $msg1 = ereg_replace('\\\"', "\"", $msg);
              $message1 = "From: $name\nemail: $email\nmessage:\n$msg1";
              $sent = mail($mailto, $subject, $msg, "From: $email\r\nReply-to: $email\r\n");
              if ($sent){
                   echo ("Your Email has been sent to $mailto!");
              }else{
                   echo "Message sending Failed";
              }
          
              ?>
          hatisblack at yahoo.com

          Comment

          • SmokeyTheBear
            ►SouthOfHeaven
            • Jun 2004
            • 28609

            #6
            there you go , that should work

            just make the "to" box hidden so they cant send email to anyone ( or alter the php to a set value )
            hatisblack at yahoo.com

            Comment

            • BannerDept
              Confirmed User
              • Apr 2006
              • 511

              #7
              hey thanks man, do you happen to have icq? Just have a quick question

              Thanks again

              ICQ: 106-293
              Summer Design Specials!

              Comment

              • SmokeyTheBear
                ►SouthOfHeaven
                • Jun 2004
                • 28609

                #8
                yup its in my sig if you need some help
                hatisblack at yahoo.com

                Comment

                Working...