R4L/Services/Hosting/Basic/FormMail
Form Mail
The following are working examples of HTML code you can use to create a form on your website. When your visitor submits this form, you will receive an email with the contents of what they submitted in the form. These forms can be used as a contact me page or other uses.
Form Mail with Captcha
A Captcha is a random set of characters that is generated on the form page that your visitor needs to type in correctly in order for the form to be processed. This technique helps reduce use of the form by automated programs that generate spam.
In this example scripts, you of course need to replace your-domain-hosting-this-script with your actual domain name.
<form action="/cgi-bin/form-captcha.cgi" method="POST"> <input type="hidden" name="recipient" value="you@your-domain-hosting-this-script.com"> <input type="hidden" name="subject" value="Web contact: http://your-domain-hosting-this-script.com"> <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT"> <table border="0" cellpadding="3" cellspacing="3" width="650"> <tr> <td class="right">Name:</td> <td><input type="text" size="30" maxlength="100" name="name"></td> </tr> <tr> <td class="right">Mailing Address:</font></td> <td><input type="text" size="20" maxlength="100" name="address"></td> </tr> <tr> <td class="right">City:</font></td> <td><input type="text" size="20" maxlength="100" name="city"></td> </tr> <tr> <td class="right">State:</font></td> <td><input type="text" size="15" maxlength="100" name="city1"></td> </tr> <tr> <td class="right">Zip or Postal Code:</font></td> <td><input type="text" size="11" maxlength="10" name="zip"></td> </tr> <tr> <td class="right">Phone:</font></td> <td><input type="text" size="15" maxlength="20" name="phone"></td> </tr> <tr> <td class="right">e-mail:</font></td> <td><input type="text" size="20" maxlength="100" name="email"></td> </tr> <tr> <td class="right" width="50%"><font size="3" face="arial">To prevent automated posts, please enter the text shown on the image as the verification code below.</font></td> <td width="50%"><font size="3" face="arial"><strong><img src="/cgi-bin/captcha.cgi" border="1"></strong></font></td> </tr> <tr> <td class="right"><font size="3" face="arial"><strong>Verification Code:</strong></font></td> <td><font size="3" face="arial"><input type="text" size="8" maxlength="20" name="verifytext" ></font></td> </tr> <tr> <td class="center" colspan="2"><input type="submit" name="submit" value="Submit"></td> </tr> </table> </form>
Form Mail without Captcha
To create a contact form without Captcha (not recommended, as it's more prone to abuse by spammers), you can use this following sample code.
<form name="web_email" method="post" action="/cgi-bin/form-mail.cgi"> <input type="hidden" name="recipient" value="you@your-domain-hosting-this-script.com"> <input type="hidden" name="subject" value="Web contact: http://your-domain-hosting-this-script.com"> <input type="hidden" name="required" value="email,realname,feedback"> <input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,HTTP_USER_AGENT"> <blockquote> <p>Name: <input type="text" size="27" name="realname" /> <p>Your Email:<b>*</b><br><input type="text" size="28" name="email" /> <p>Have you visited us before?<br /> <select name="visit"> <option value="Yes" />Yes <option value="No" />No </select> <p><e>How did you find our web site?</p> <select name="refer"> <option value="search_engine">Search Engine <option value="commercial_tv">Television Commercial <option value="online_ad">Online ad <option value="friend">Friend - Word of mouth <option value="other">Other </select> <p>Enter your question or feedback below: <br /> <textarea rows="8" name="feedback" cols="40"></textarea> <br /><br /> <input type="submit" value="Send Message" name="send"></p> </blockquote> </form>