我可以使用 mailto: 设置电子邮件的主题/内容吗? [英] Can I set subject/content of email using mailto:?

查看:50
本文介绍了我可以使用 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:no-one@snai1mai1.com?subject=free chocolate">example</a>

带有内容的mailto:

mailto with content:

<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>

正如评论中提到的,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: 设置电子邮件的主题/内容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆