Form action mailto Send mail

Source: Internet
Author: User

How to submit a form directly to an email via the HTM page
Solution idea: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 message subject and body of the input box

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

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

3. Set the cc and Password address input box

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

4. Complete code

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

Attention:
L The form's action value must be formatted as "mailto: Destination email address", which is similar to the email link.
L Enctype (MIME encoding) must be set to "Text/plain" (text), otherwise the message received is garbled. L The method property of the form cannot be set to post, it must be get (the default is not set to get), otherwise the message format does not match the user input.
(Method II) 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 Study :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 Tel </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 Application" > </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 websiteHttp://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.