HostGator »

FormMail

Steps to making a form on your website where people can email you information....



  1. Copy the below code.
  2. Replace the words in bold black with your domain name and your email.
  3. Replace the words in bold blue with whatever you want that part of the form to say.
  4. Save it as a .html .
  5. Upload and you are done.
Note: Make sure you use an email address on the server as you can't use an outside email address for security reasons. You can always use a forwarder to send it to an outside email address as well.
Version 1 (No Validation)
<html>
<head>
<title>FormMail Demo</title>
</head>
<body>
<form action="http://www.mydomain.com/cgi-sys/formmail.pl" method="post">
<input type="hidden" name="recipient" value="youremail@here.com">
<input type="hidden" name="subject" value="FormMail E-Mail">
Whatever you want to say here<br /><br />
<input type="text" name="email" size="20" value="Visitor E-Mail"><br />
<input type="text" name="tellme" size="20" value="E-Mail Content"><br /><br />
<input type="submit" name="submit" value="E-Mail Me!">
<input type="hidden" name="redirect" value="http://yourdomain.com/redirecto.html">
</form>
</body>
</html>
If you copy and upload exactly the code we have above, it will look like this....
Click here to see an example of version 1
Version 2 (Javascript Validation)
<html>
<head>
<title>FormMail Demo</title>
<script type="text/javascript">
function hgsubmit()
{
if (/^\S+@[a-z0-9_.-]+\.[a-z]{2,6}$/i.test(document.hgmailer.email.value) == false) alert ("Valid email address required.");
 else if (/\S+/.test(document.hgmailer.tellme.value) == false) alert ("Email content required.");
  else {
       document.hgmailer.submit();
       alert ('Thank you!');
       }
}
</script>
</head>
<body>
<form action="http://www.mydomain.com/cgi-sys/formmail.pl" method="post" name="hgmailer">
<input type="hidden" name="recipient" value="youremail@here.com">
<input type="hidden" name="subject" value="FormMail E-Mail">
Whatever you want to say here<br /><br />
Visitor E-Mail: <input type="text" name="email" size="20" value=""><br />
E-Mail Content: <input type="text" name="tellme" size="20" value=""><br /><br />

<input type="button" value="E-Mail Me!" onclick="hgsubmit();">
<input type="hidden" name="redirect" value="http://www.mydomain.com/path">
</form>
</body>
</html>
If you copy and upload exactly the code we have above, it will look like this....
Click here to see an example of version 2
 
Information
support

McAfee Secure sites help keep you safe from identity theft, credit card fraud, spyware, spam, viruses and online scams

E-mail
sales@hostgator.com
support@hostgator.com

Visit our FAQ for more information.
Rocket Fuel