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.
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>
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.