Form action mailto e-mail

Source: Internet
Author: User

How to submit a form directly to an email via the HTM page
Solution Ideas:The key point is to set the form's Action property to "mailto:" +email address.
(method i) Specific steps:1. Set the Action property of the form to receive the email address of the message and set the MIME encoding of the form.

<form action= "mailto:yourname@domain.com" enctype= "Text/plain" >
</form>

2. Set the input box for the subject and body of the message

Subject: <input name= "Subject" type= "text" ><br>
Body: <textarea name= "Body" ></textarea><br>

<input name= "Subject" type= "text" >

3. Set cc and Password Address entry boxes

CC: <input name= "CC" type= "text" ><br>
Secret delivery: <input name= "bcc" type= "text" ><br>

4. Complete code

<form action= "mailto:yourname@domain.com" enctype= "Text/plain" >
Subject: <input name= "Subject" type= "text" ><br>
CC: <input name= "CC" type= "text" ><br>
Secret delivery: <input name= "bcc" type= "text" ><br>
Body: <textarea name= "Body" ></textarea><br>
<input type= "Submit" >
</form>

Attention:
The action value of the form must be in the format "mailto: Target email address", which is similar to the email link.
L Enctype (MIME encoding) must be set to "Text/plain" (text), otherwise the received message is garbled. The method property of the form cannot be set to post and must be get (default is not set to get), otherwise the message format does not conform to user input.
(method Two) Specific steps:<a href= "mailto:youname@domain.com?subject=title&cc=name1@domain.com,name2@domain.com&bcc= Bccname@domain.com&body=hello world! " >mailto</a>

Case :HTML code: <form name= "Form" method= "POST" action= "mailto:service@kashuo.com" enctype= "Text/plain" > <table cell padding= "0" cellspacing= "0" > <tr> <th> name </th> <td><input Typ E= "text" name= "name" class= "popup-btn" ></td> </tr>
<tr> <th> Contact Phone </th> <td><input type= "text" name= "iphone" class= "POPUP-BT N "></td> </tr>
<tr> <td></td> <td><input name= "Close" type= "Bottn" onclick= "Getmailto URL () "class=" popup-btn popup-btn1 "value=" Submit Request "> </td> </tr> </table> </f Orm>
JS code: <script type= "Text/javascript" > Function Getmailtourl () {var args = [];         if (typeof subject!== ' undefined ') {args.push (' subject= ' + encodeuricomponent (' subject content '));         } var name = $ ("Input[name= ' name ']"). Val ();         var iphone = $ ("input[name= ' iphone ']"). Val (); var BODY = name + "\ n" +iphone if (typeof body!== ' undefined ') {args.push (' body= ' + encodeuricomponent         (body)) }
var url = ' mailto: ' + encodeuricomponent (' service@kashuo.com ');         if (Args.length > 0) {url + = '? ' + args.join (' & ');         } console.log (URL);         window.location = URL;     return URL; } </script>

note) Reference siteHttp://www.5icool.org/a/201003/308.html http://www.w3dev.cn/article/20111008/form-action-mailto-protocal.aspx Http://it.taocms.org/10/8905.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.