我可以使用mailto:来设置电子邮件的主题/内容吗?

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

解决办法

是的,请看所有的技巧和窍门与mailto: http://www.angelfire.com/dc/html-webmaster/mailto.htm

mailto主题的例子。

<a href="mailto:no-one@snai1mai1.com?subject=free chocolate">example</a>

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>

正如评论中所提到的,subject'和body'都必须被正确转义。对每一个都使用`encodeURIComponent(subject)',而不是在特定情况下手工编码。

正如Hoody在评论中提到的,你可以通过在字符串中加入以下编码序列来添加换行符。

%0D%0A // one line break
评论(15)
mailto:joe@company.com?subject=Your+subject
评论(1)

是的,你可以像这样。

mailto: email@host.com?subject=something
评论(1)