Mailto usage
How to Use mailto?
1) basic usage
Copy codeThe Code is as follows:
<A href = mailto: sample@163.com> send email </a>
Or
Copy codeThe Code is as follows:
<Form action = "mailto: sample@163.com">
</Form>
Mailto is followed by the recipient.
List of available parameters
To |
Recipient |
Suject |
Topic |
Cc |
CC |
Bcc |
Dark CC |
Body |
Content |
The parameter passing method is the same as passing values between pages. You can use a query string or form
Querystring Method:
Copy codeThe Code is as follows:
<A href = "mailto: sample@163.com? Subject = test & cc = sample@hotmail.com & body = use mailto sample "> send mail </a>
Form
Copy codeThe Code is as follows:
<Form name = 'sendmail' action = 'mailto: sample@163.com '>
<Input name = 'cc' type = 'text' value = 'sample @ hotmail.com '>
<Input name = 'object' type = 'text' value = 'test'>
<Input name = 'body' type = 'text' value = 'use mailto sample'>
</Form>
Both methods also pass all parameters.
2) Example
Copy codeThe Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
<HTML>
<HEAD>
<TITLE> Send Email </TITLE>
<Meta name = "Generator" CONTENT = "EditPlus">
<Meta name = "Author" CONTENT = "">
<Meta name = "Keywords" CONTENT = "">
<Meta name = "Description" CONTENT = "">
</HEAD>
<Script>
Date. prototype. toString = function ()
{
Var d = new Date ();
Var ret = d. getYear ();
Var m = d. getMonth () + 1;
Ret + = m. length> 1? M: '0' + m;
Var date = d. getDate ();
Ret + = date. length> 1? Date: '0' + date;
Return ret;
}
Var initSubject = 'test' + new Date (). toString (), initTo = 'sample @ 163.com ', initCC = 'sample @ hotmail.com', initBody = 'use mailto sample ';
Function submitHandler ()
{
Var subject = subText. value;
Var to = toText. value;
Var cc = ccText. value;
Var body = bodyText. value;
MailTo. href = "mailto:" + to + "? Cc = "+ cc +" & subject = "+ subject +" & body = "+ body;
MailTo. click ();
}
Function init ()
{
SubText. value = initSubject;
ToText. value = initTo;
CcText. value = initCC;
BodyText. value = initBody;
}
</Script>
<Style>
. Label {font-weight: bold; postion: absolute; width: 80px ;}
. Head {font-color: black; font-weight: bold ;}
. Bd {float: left; width: 77px; font-weight: bold ;}
</Style>
<BODY onload = "init ()">
<Div class = "head"> Use mailto Send Email </div>
<Div>
<Span class = "label"> Subject: </span> <input id = "subText" type = "text" size = 50 value = "TM V14.2 Bug Fix Questions_20080221">
</Div>
<Div>
<Span class = "label"> To: </span> <input id = "toText" type = "text" size = 50 value = "">
</Div>
<Div>
<Span class = "label"> CC: </span> <input id = "ccText" type = "text" size = 50 value = "">
</Div>
<Div>
<Span class = "bd"> Body: </span> <textarea id = "bodyText" rows = 20 cols = 100> </textarea>
</Div>
<Input name = "btSend" type = "button" value = "send email" onclick = "submitHandler ();">
<A href = "mailto:" id = "mailTo"> </a>
</BODY>
</HTML>
Find ways for winners and find excuses for losers!