How to Create Mailto Forms
Mailto forms are used in websites to keep in touch with visitors so that they can ask questions, offer suggestions, or give feedback. These forms are easy to work with, and they usually include fields for an email address, user name, and a text area for the message.
When a visitor submits a Mailto form, the Mailto link will open the visitor's email client filled with the form contents. Then, the visitor can click "Send" to produce an email to the Web admin.
For creating a simple Mailto Form you need to use the <form> element with its action (specifies the address (URL) where to submit the form), method (specifies the HTTP method to use when submitting the form) and enctype (specifies the encoding of the submitted data) attributes, insert a mailto: link, a <textarea> element and an <input> element for submitting the form.
You can use 3 possible values for enctype encoding:
- application/x-www-form-urlencoded is the proper option for the majority of simple HTML forms. It is the default value if the enctype attribute is not specified.
- multipart/form-data is necessary if your users are required to upload a file through the form.
- text/plain is a valid option, although it sends the data without any encoding at all. It is not recommended, as its behavior is difficult to predict.
<html> <head> <title>Title of the document</title> </head> <body> <h2> Give Feedback to Our Website.</h2> <form action="mailto:email@example.com" method="get" enctype="text/plain"> <p>Name: <input type="text" name="name"/></p> <p>Email: <input type="text" name="email"/></p> <p>Comments: <br /> <textarea name="comments" rows = "12" cols = "35">Send your comments to the website.</textarea> <br> <p><input type="submit" name="submit" value="Send" /> <input type="reset" name="reset" value="Clear Form" /> </p> </form> </body> </html>
The Advantages of Mailto Forms
A Mailto form allows you to ask specific questions while a Mailto link doesn’t. Considering the answers, you can easily sort your Email messages and answer those which are essential to respond.
Moreover, using a form lets you not always show the Email address on the web page so that spammers won’t flow.