本文介绍了我可以使用mailto:设置电子邮件的主题/内容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用mailto时是否可以设置电子邮件的主题/内容?

Is it possible to set the subject/content of email when I use mailto:?

推荐答案

是的,请使用mailto查找所有提示和技巧: http://www.angelfire.com/dc/html-webmaster/mailto.htm

Yes, look all tips and tricks with mailto: http://www.angelfire.com/dc/html-webmaster/mailto.htm

mailto主题示例:

mailto subject example:

<a href="mailto:[email protected]?subject=free chocolate">example</a>

带有内容的邮件:

<a href="mailto:[email protected]?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>

如注释中所提及,subjectbody必须正确转义.在每种情况下都使用encodeURIComponent(subject),而不是在特定情况下进行手工编码.

As alluded to in the comments, both subject and body must be escaped properly. Use encodeURIComponent(subject) on each, rather than hand-coding for specific cases.

正如注释中提到的 Hoody 一样,您可以通过在字符串中添加以下编码序列来添加换行符:

As Hoody mentioned in the comments, you can add line breaks by adding the following encoded sequence in the string:

%0D%0A // one line break

这篇关于我可以使用mailto:设置电子邮件的主题/内容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 22:53