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)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<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://mydomain.com/redirect-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 1
Version 2 (Javascript Validation)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>FormMail Demo</title>
<script type="text/javascript">
function hgsubmit()
{
if (/\S+/.test(document.hgmailer.name.value) == false) alert ("Please provide your name.");
else if (/^\S+@[a-z0-9_.-]+\.[a-z]{2,6}$/i.test(document.hgmailer.email.value) == false) alert ("A valid email address is required.");
 else if (/\S+/.test(document.hgmailer.comment.value) == false) alert ("Your email content is needed.");
  else {
       document.hgmailer.submit();
       alert ('Thank you!\nYour email is sent.');
       }
}
</script>
</head>
<body>
<form action="http://www.mydomain.com/cgi-sys/formmail.pl" method="post" name="hgmailer">
<input type="hidden" name="recipient" value="myemail@mydomain.com">
<input type="hidden" name="subject" value="FormMail E-Mail">
Whatever you want to say here<br><br>
Visitor Name: <input type="text" name="name" size="30" value=""><br>
Visitor E-Mail: <input type="text" name="email" size="30" value=""><br>
E-Mail Content: <textarea name="comment" cols="50" rows="5"></textarea><br><br>
<input type="button" value="E-Mail Me!" onclick="hgsubmit();">
<input type="hidden" name="redirect" value="http://www.mydomain.com/redirect-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
support

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