Create HTML Email

 

Create HTML Email - HTML Mailto, Email HTML Forms

Creating an email form in HTML is very simple. The sample codes and explanations for various HTML email forms are given below. In this article, you can learn one of the easiest methods to create HTML email forms. It doesn’t require a vast knowledge of other features of the language. The only thing is that you have to be careful to use the tags exactly as given in the code. A form requires user input boxes and form fields for taking inputs from the users. To create a form in HTML, the element <Form> is used. A form starts at the tag <form> and closes at the tag <form>. The various attributes of a form element are action, method, and enctype. Action takes in the address of the webpage or the email address where the data entered in the form will be viewed on submission. The method attributes takes in two values, namely, “post” and “get”. Post method is used if the data entered in the textboxes is to be returned to the server in encoded form. “Get” is used if the data is sent in query string format. To get the data in the mail client, the enctype attribute is used and it’s given the value “text/plain” to depict the data clearly in text plain format.


Here’s a sample code:

<HTML>

<head>

<Title>form</Title>

</head>

<Body>

<form action="mailto:anybody@anybody.com" method="post" enc >

<center><b>Email Form for Testing </b><p>

<Table>

<tr><td><b>Name:</b></td><td><input size="20"><p></td></tr>

<tr><td><b>Email:</b></td><td><input size="20"><p></td></tr>

<tr><td><b>Comment:</b></td><td><textarea name="comment" cols="25" wrap="virtual" rows="3"></textarea><p></td></tr>

<tr><td><input value="Submit"></td><td>

<input value="Reset"></td></tr>

</Table>

</form>

</body>

</html>

The Input Box is a textbox where the user makes entries. You can use the code “<input>” to make an input box. The attribute type=“text” indicates that it’s a textbox. “Name” is used to name the input box and “size” defines the input box’s width. The “submit” button will take the entries from the input box and send it to the server.

The Text Area is a larger box where a user can enter a paragraph or a larger text. The user can view the text in rows which is not visible in an input textbox. The element Textarea is used to make a text area in a form and the code is:

“<textarea name="comment" cols="25" wrap="virtual" rows="3"> </textarea>”

The Text Area is named by the “name” attribute and you can use any name as per your preference. The “cols” indicate the number of column and “rows” are the figure of rows in the text area.

The Submit Button refers to the button that is placed below the form input fields. As the user clicks the submit button, it sends all the entries made in the form input field to the server. The Submit Button can be placed on a form by using the code:

“<input value="Submit">”

The input field is taken as “submit”. The user can give any name or value to the button but the “type” attribute should be “submit”. The “value” field refers to the text which is displayed on the input button.

The code for creating the input boxes is placed in between the <form> elements. A “submit” button is designed to send the values entered in the boxes to the server or to an email feedback form. The main attributes of <form> are “action”, “method”, and “enctype”. For every HTML email form, a submit button should be available. “Reset” or “Clear” buttons are used to clear user entries from the input fields. Check out these links to learn more about Email HTML forms.