Creating e-mail form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TanBrae
    New Member
    • May 2006
    • 7

    Creating e-mail form

    Hi all,
    I'm fairly new to creating web pages. My current site has a form that has not been working for some time. I've had several people try to fix it, but it still won't work. (long story, short version - my webhost sold to a different company who apparently did not support asp(?), so the form quit working. I changed hosts after asking for help several times and getting nothing in reply, or no help. Current host also does not support asp, and suggested I use cgi. The most recent person who worked on the form had it sending for one day, then it quit again.)

    I'm wondering if it is possible to just do a "contact me" e-mail with the information in it. People can just fill out the information directly in the e-mail and send it. That way, it will come to me! (hopefully!) Is there any way of putting a "form" in a "contact me" e-mail? Also, could it be directed to a specific folder in my inbox? If you'd like to take a look, my site URL is: http://www.tanbraelabr adors.com
    I could really use help on this!
  • steven
    New Member
    • Sep 2006
    • 143

    #2
    You really need to know exactly what your web servers running, what's available and which method you want to use. For example, you could use PHP, but the server would also have to have a mail server installed and you have to have access permissions to use it. Then in your code, you could use the mail() command.

    You could just do a mailto: link in your HTML, so that when the visitor selects it, their email client opens up and you can automatically fill the subject and address.

    Routing incoming emails to different folders in your email client is something you would do using filters. For example, you could direct all incoming messaged from a specific address, or containing a specific subject to a specified directory of your choice. Using filters in modern pop clients is pretty simple and you can figure them out without the need for manuals and such. I'm sure even webmail clients provide the same features.

    Comment

    • 2jdesign
      New Member
      • Oct 2006
      • 7

      #3
      I have a good PHP script if you want it, you will need to know if you hosting provider allow nobody emails though, email me and I'll pass it on
      jamie@2jdesign. co.uk

      Comment

      • TanBrae
        New Member
        • May 2006
        • 7

        #4
        My current host now supports PHP, Perl, and CGI. When I switched, I don't know why the CGI stopped working, but it did. The form does work now, but I cannot just hit reply to make a response - I have to copy the sender's email address, then paste in the compose box.

        When the form was working from the original host, it came to a sub-folder in my inbox, and when I was done uploading to my site, I'd just hit reply to send notification that their information was uploaded. I LIKED that! I MISS it! LOL

        Not to mention, there have been so many people trying to help me, and they have made changes I did NOT want made on other pages of my site. Argh! I really need to take classes!

        So, if anybody from here would like to help with another "problem", I'd appreciate it.

        On this page: http://www.tanbraelabr adors.com/optigen.html
        which, to get here, you click on this page on the "submit" button, it should be only ONE page - the green one. One should NOT see the bottom half of the original page there! I did not intend for that bottom frame to be seen in the instructions page. I just don't know how to fix it so it doesn't show. I didn't make it, so am not sure about the coding.

        Comment

        • AricC
          Recognized Expert Top Contributor
          • Oct 2006
          • 1885

          #5
          Here is a pretty simple email script:


          The HTML Page:
          Code:
          <html>
          <head>
          <title>Email</title>
          <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
          <meta http-equiv="Content-Language" content="en-uk">
          <link rel="stylesheet" type="text/css" href="" /> </head>
          <body><center>
          <h1>Email Me (All Fields Required):</h1>
          <form action="Email.php" method="post">
          <table border="0" cellspacing="5">
          	<tr>
          	 <td><font face="arial" size="2">Name</font></td>
          	 <td><input type="text" size="30" name="Name"></td>
          	</tr>
          	<tr>
          	 <td><font face="arial" size="2">Email address</font></td>
          	 <td><input type="text" size="30" name="Email"></td>
          	</tr>
          	<tr>
          	 <td valign="top"><font face="arial" size="2">Comments</font></td>
          	 <td><textarea name="Comments" rows="6" cols="30"></textarea></td>
          	</tr>
          	<tr>
          	 <td>&nbsp;</td>
          	 <td><input type="submit" value="Send"><input type="reset" value="Clear"></td>
          	</tr>
          </table>
          </form>
          </center>
          </body>
          </html>
          PHP script
          Code:
          <?php
          $my_email = "YOUR EMAIL GOES HERE";
          $continue = "http:google.com/";
           
          // This line prevents values being entered in a URL
          if ($_SERVER['REQUEST_METHOD'] != "POST"){exit;}
          // Check for disallowed characters in the Name and Email fields.
          $disallowed_name = array(':',';',"'",'"','=','(',')','{','}','@');
          foreach($disallowed_name as $value)
          {
          if(stristr($_POST[Name],$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
          }
          $disallowed_email = array(':',';',"'",'"','=','(',')','{','}');
          foreach($disallowed_email as $value)
          {
          if(stristr($_POST[Email],$value)){header("location: $_SERVER[HTTP_REFERER]");exit;}
          }
          $message = "";
          // This line prevents a blank form being sent
          while(list($key,$value) = each($_POST)){if(!(empty($value))){$set=1;}$message = $message . "$key: $value\n\n";} if($set!==1){header("location: $_SERVER[HTTP_REFERER]");exit;}
          $message = $message . "Sent From YOUR SITE GOES HERE";
          $message = stripslashes($message);
          $subject = "Email From YOUR SITE GOES HERE";
          $headers = "From: " . $_POST['Email'] . "\n" . "Return-Path: " . $_POST['Email'] . "\n" . "Reply-To: " . $_POST['Email'] . "\n";
          mail($my_email,$subject,$message,$headers);
          ?>
          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
          <html>
          <head>
          <title>Thanks You For The Email!</title>
          <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
          <meta http-equiv="Content-Language" content="en-uk">
          <link rel="stylesheet" type="text/css" href="" />
          </head>
          <body>
          <object><center>
          <h1>Thank you <?php print stripslashes($_POST['Name']); ?>!</h1>
          <h2>Your message has been sent</h2>
          <h3><a href="javascript:window.close()">Close</a></h3>
          </object>
          </font>
          </body>
          </html>

          Comment

          • TanBrae
            New Member
            • May 2006
            • 7

            #6
            Thanks, Aric. I'll give the CGI a try. LOL, IF I can get it to work! I use Netscape Composer for creating my site, and am not certain how to get that code to show in that. If I paste it in Notepad, then open Notepad in Composer, will that work?

            Comment

            Working...