Hai*_*vgi 1409
是的,请查看mailto的所有提示和技巧:http://www.angelfire.com/dc/html-webmaster/mailto.htm
mailto主题示例:
<a href="mailto:no-one@snai1mai1.com?subject=free chocolate">example</a>Run Code Online (Sandbox Code Playgroud)
mailto内容:
<a href="mailto:no-one@snai1mai1.com?subject=look at this website&body=Hi,I found this website and thought you might like it http://www.geocities.com/wowhtml/">tell a friend</a>Run Code Online (Sandbox Code Playgroud)
正如评论提到,无论是subject和body必须正确转义.encodeURIComponent(subject)在每个上使用,而不是手动编码特定情况(如subject换行符).
odi*_*com 117
<a href="mailto:manish@simplygraphix.com?subject=Feedback for
webdevelopersnotes.com&body=The Tips and Tricks section is great
&cc=anotheremailaddress@anotherdomain.com
&bcc=onemore@anotherdomain.com">Send me an email</a>
Run Code Online (Sandbox Code Playgroud)
您可以使用此代码来设置主题,正文,抄送,密送
Wil*_*ken 36
该mailto:URL方案定义在RFC 2368.此外,将信息编码为URL和URI的约定在RFC 1738和RFC 3986中定义.这些规定了如何将body和subject头包含在URL(URI)中:
mailto:infobot@example.com?subject=current-issue&body=send%20current-issue
Run Code Online (Sandbox Code Playgroud)
具体而言,您必须对电子邮件地址,主题和正文进行百分比编码,并将其置于上面的格式中.百分比编码的文本在HTML中是合法的,但是href根据HTML4标准,此URL必须是实体编码才能在属性中使用:
<a href="mailto:infobot@example.com?subject=current-issue&body=send%20current-issue">Send email</a>
Run Code Online (Sandbox Code Playgroud)
最常见的是,这是一个简单的PHP脚本,按上述方式编码.
<?php
$encodedTo = rawurlencode($message->to);
$encodedSubject = rawurlencode($message->subject);
$encodedBody = rawurlencode($message->body);
$uri = "mailto:$encodedTo?subject=$encodedSubject&body=$encodedBody";
$encodedUri = htmlspecialchars($uri);
echo "<a href=\"$encodedUri\">Send email</a>";
?>
Run Code Online (Sandbox Code Playgroud)
nik*_*mac 24
您可以使用以下任一方法添加添加到mailto命令的主题.添加?subject mailto到mailto标签.
<a href="mailto:test@example.com?subject=testing out mailto">First Example</a>
Run Code Online (Sandbox Code Playgroud)
我们还可以通过在标记的末尾添加&body来将文本添加到消息正文中,如下例所示.
<a href="mailto:test@example.com?subject=testing out mailto&body=Just testing">Second Example</a>
Run Code Online (Sandbox Code Playgroud)
除了正文之外,用户还可以键入&cc或&bcc来填写CC和BCC字段.
<a href="mailto:test@example.com?subject=testing out mailto&body=Just testing&cc=test1@example.com&bcc=test1@example.com">Third
Example</a>
Run Code Online (Sandbox Code Playgroud)
我创建了一个开源工具来简化此过程。输入您想要的字符串,您将立即获得mailto:
?? 在mailto中模板完整的电子邮件
这是诀窍 http://neworganizing.com/content/blog/tip-prepopulate-mailto-links-with-subject-body-text
<a href="mailto:tips@neworganizing.com?subject=Your+tip+on+mailto+links&body=Thanks+for+this+tip">tell a friend</a>
Run Code Online (Sandbox Code Playgroud)
我把它分成不同的行,使它更具可读性.
<a href="
mailto:johndoe@gmail.com
?subject=My+great+email+to+you
&body=This+is+an+awesome+email
&cc=janedoe@gmail.com
&bcc=billybob@yahoo.com
">Click here to send email!</a>
Run Code Online (Sandbox Code Playgroud)
是的,你可以这样:
mailto: email@host.com?subject=something
Run Code Online (Sandbox Code Playgroud)
小智 5
请注意,根据RFC 2368,不可能在消息正文中使用HTML :
特殊的hname“ body”表示关联的hvalue是消息的主体。“正文”名称应包含消息的第一个文本/纯文本正文部分的内容。mailto URL主要用于生成实际上是自动处理内容的短文本消息(例如,邮件列表的“订阅”消息),而不是常规的MIME正文。
信用:https : //stackoverflow.com/a/13415988/1835519
下面是一个可运行的代码片段,可帮助您生成带有可选主题和正文的 mailto: 链接。
function generate() {
var email = $('#email').val();
var subject = $('#subject').val();
var body = $('#body').val();
var mailto = 'mailto:' + email;
var params = {};
if (subject) {
params.subject = subject;
}
if (body) {
params.body = body;
}
if (params) {
mailto += '?' + $.param(params);
}
var $output = $('#output');
$output.val(mailto);
$output.focus();
$output.select();
document.execCommand('copy');
}
$(document).ready(function() {
$('#generate').on('click', generate);
});Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" id="email" placeholder="email address" /><br/>
<input type="text" id="subject" placeholder="Subject" /><br/>
<textarea id="body" placeholder="Body"></textarea><br/>
<button type="button" id="generate">Generate & copy to clipboard</button><br/>
<textarea id="output">Output</textarea>Run Code Online (Sandbox Code Playgroud)