diff options
Diffstat (limited to 'files/zh-cn/web/guide/html/email_links/index.html')
| -rw-r--r-- | files/zh-cn/web/guide/html/email_links/index.html | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/files/zh-cn/web/guide/html/email_links/index.html b/files/zh-cn/web/guide/html/email_links/index.html new file mode 100644 index 0000000000..3a020fcbee --- /dev/null +++ b/files/zh-cn/web/guide/html/email_links/index.html @@ -0,0 +1,85 @@ +--- +title: Email links +slug: Web/Guide/HTML/Email_links +tags: + - HTML5 + - SEO + - a + - email link + - mailto +translation_of: Learn/HTML/Introduction_to_HTML/Creating_hyperlinks#E-mail_links +--- +<p>这往往是有益的Web站点能够创建链接或按钮,点击后,打开一个新的出站电子邮件。例如,这可能会创造一个“联系我们”按钮时使用。这是使用完成<span class="seoSummary">{{HTMLElement("a")}} </span>元素和mailto URL方案。<span class="seoSummary">.</span></p> + +<h2 id="Mailto_基础">Mailto 基础</h2> + +<p>以它最基础和最常用的形式,一个<code>mailto</code>链接仅简单的指明目标收件人的邮箱地址。例如:</p> + +<pre class="brush: html"><a href="mailto:nowhere@mozilla.org">Send email to nowhere</a> + +Complete examples detail: + +<a href="mailto:nowhere@mozilla.org?cc=name2@rapidtables.com&bcc=name3@rapidtables.com +&amp;subject=The%20subject%20of%20the%20email +&amp;body=The%20body%20of%20the%20email"> +Send mail with cc, bcc, subject and body</a></pre> + + + +<p>这导致链接看起来像这样: <a href="mailto:nowhere@mozilla.org">Send email to nowhere</a>.</p> + +<p>事实上, 目标收件人邮件地址都是可选的。 如果你不添加它 (也就是,你的{{htmlattrxref("href", "a")}} 是简单的 "mailto:"),用户的邮件客户端将打开一个新的外发电子邮件窗口,该窗口尚未指定目标地址。这通常非常有用,因为用户可以单击“共享”链接以将电子邮件发送到他们选择的地址。</p> + +<h2 id="指定细节">指定细节</h2> + +<p>除了电子邮件地址,您还可以提供其他信息。事实上, 任何标准的邮件头字段都可以添加到您提供的<code>mailto</code> URL中。 最广泛使用的是: "subject", "cc", and "body" (这不是真正的标题字段,但允许您为新电子邮件指定简短内容消息). 每个字段及其值都被指定为一个查询字词(query term)。</p> + +<div class="blockIndicator note"> +<dl> + <dt>译者注:</dt> +</dl> + +<ul> + <li>`subject`:主题</li> + <li>`cc`:抄送到次要收件人(与邮件有关但无需做出应答的个人或组织)</li> + <li> `bcc`:密送到其他收件人。主要、次要收件人不应该获得密送收件人的身份。</li> + <li>`body`:邮件内容</li> +</ul> +</div> + +<div class="note"> +<p><strong>Note:</strong> 每个字段的值都必须进行编码 (也就是, 带有非印刷字符和空格 <a href="http://en.wikipedia.org/wiki/Percent-encoding">percent-escaped</a>).</p> +</div> + +<h3 id="样品mailto_网址">样品mailto 网址</h3> + +<p>这有一些有关<code> mailto</code> 的示例链接:</p> + +<ul> + <li><a href="mailto:">mailto:</a></li> + <li><a href="mailto:nowhere@mozilla.org">mailto:nowhere@mozilla.org</a></li> + <li><a href="mailto:nowhere@mozilla.org,nobody@mozilla.org">mailto:nowhere@mozilla.org,nobody@mozilla.org</a></li> + <li><a href="mailto:nowhere@mozilla.org?cc=nobody@mozilla.org">mailto:nowhere@mozilla.org?cc=nobody@mozilla.org</a></li> + <li><a href="mailto:nowhere@mozilla.org?cc=nobody@mozilla.org&subject=This%20is%20the%20subject">mailto:nowhere@mozilla.org?cc=nobody@mozilla.org&subject=This%20is%20the%20subject</a></li> +</ul> + +<p>请注意,使用&符号来分隔mailto URL中的每个字段。这是标准的URL查询表示法。</p> + +<h3 id="例子">例子</h3> + +<p>如果您想创建一封要求订阅新闻通讯的外发电子邮件, 您可能会使用一个 <code>mailto链接,像这样</code>:</p> + +<pre class="brush: html"><a href="mailto:nowhere@mozilla.org?subject=Newsletter%20subscription%20request&body=Please%20subscribe%20me%20to%20your%20newsletter!%0A%0AFull%20name%3A%0A%0AWhere%20did%20you%20hear%20about%20us%3F"> +Subscribe to our newsletter +</a></pre> + +<p>结果链接看起来像这样: <a href="mailto:nowhere@mozilla.org?subject=Newsletter%20subscription%20request&body=Please%20subscribe%20me%20to%20your%20newsletter!%0A%0AFull%20name%3A%0A%0AWhere%20did%20you%20hear%20about%20us%3F">Subscribe to our newsletter</a>.</p> + +<section id="Quick_Links"> +<ol> + <li>{{HTMLElement("a")}}</li> + <li>{{RFC(6068, "The 'mailto' URI Scheme")}}</li> + <li>{{RFC(5322, "Internet Message Format")}}</li> + <li><a href="http://www.url-encode-decode.com/">URL encode/decode online</a></li> +</ol> +</section> |
