How to Send Email Using HTML
HTML provides the tools necessary to create an online form. These forms accept data from a user and send it to the server for processing. A common use of the HTML form is to send email. Web designers integrate these HTML forms on a site to control the information a user sends and how it is routed. The user types in an HTML form box and presses a "Submit" button. The server then sends the text as an email. This task is a frequent component of websites and is easy to integrate into an existing site.
Instructions
-
-
1
Confirm that your web server supports PHP. This tool integrates with HTML to process the majority of email forms present on the Internet. Ask your web hosting provider if you have access to the PHP compiler. If you do not, you will need to upgrade your account or seek another provider that offers PHP. This tool is ubiquitous and any server that does not support it will likely not allow HTML email forms.
-
2
Build, copy or purchase a simple HTML form that requests the data necessary to send an email. This form would accept the user's name, his email address, a subject line (if desired), and the body of the email message. Many are available for free online (see References). Or you may use an existing HTML form to process the PHP and send email from it.
-
-
3
Create a new text file with the extension ".php". This file name must be the same as the file name used in the "action" field of the HTML form.
-
4
Paste a PHP script that handles server email tasks into this new text file. These scripts are readily available online for free (see References). Often the PHP script and the HTML form are available as a matched pair to make the creation of an HTML email form as easy as possible. The one line in this PHP script that requires customization is the portion containing the "mail()" command. The first parameter inside the parentheses should be the email address that will receive the emails from the HTML form.
-
5
Upload the PHP script and the HTML form to the same web directory of a website.
-
6
Visit the URL for the HTML form. This is the web address where the page is located that contains the input fields for the user to type the email message.
-
7
Complete the HTML form and press the "Submit" button. Within a few seconds, an email will arrive at the intended address.
-
1