How to Send Email From an HTML Page

by Kay Daniels

An email contact link makes a good addition to nearly any type of website, giving visitors a means of sending questions or other forms of feedback to the site owner. Although adding a contact form into an HTML page might sound a little bit complicated if you are brand new to HTML, the truth is that sending email from an HTML page is actually pretty easy to do.

Use a Mailto Link

Decide which email address you want to receive the emails from your website.

Create the HTML page from which you want the users to be able to send an email.

Add an anchor tag that contains a mailto: link. It should look like this: <a href="mailto:abc@youremail.com">

Insert the email address you selected in Step 1 into the tag you just created, then type the text that you want to be clickable.

Type </a> to close the anchor tag. The final result should look something like this: <a href="mailto:abc@youremail.com">Contact Me</a>. You can now upload your HTML page to your server, and website visitors will be able to click on it to send you email.

Use a Form

Create an HTML form using either a hard-coded HTML document or an HTML editor such as DreamWeaver or Nvu, including fields for the information you wish to collect from the users (such as name, email, etc).

Set appropriate value or name attributes to each input tag in your HTML form in order to ensure that you can identify and understand the data properly when you receive it.

Locate a form mail script. Your Web host may have pre-set scripts available through your hosting plan. If you do not already have access to an existing form mail, search for a free form mail CGI script on the Internet, then follow the instructions to customize the script and upload it to your server. Add any necessary variables, such as setting up the email address that should receive the form results.

Set the action attribute of your form tag to point to the location of your script and the method to either "post" or "get" as specified in the form setup instructions.

Add any necessary hidden variables and input fields to your HTML form that are required in the script setup instructions.

Upload your HTML form to your server in the correct location, double-checking that you have set up the action attribute to correctly point to your form script.

Send a test email to yourself using the form and make sure that it works correctly.

About the Author

Kay Daniels is a freelance writer with more than 10 years of experience writing and editing online. She has a bachelor's degree in psychology from Excelsior College, a certificate in copy editing from University of California, San Diego Extension, and is in her second year of medical school.