HTML:在电子邮件主题中插入换行符,例如%20是一个空格?

时间:2013-02-22 08:18:42

标签: html email

... BreakHere

我想知道是否可以为换行符写%20(代表空格)之类的东西。所以我希望在我的电子邮件正文中有单独的行。

有什么想法吗?

2 个答案:

答案 0 :(得分:32)

您应该使用回车%0D和换行符%0A

<a href="mailto:endpointadress@something.com?cc=endpointadress2@something.com&subject=your subject&body=Text before new line.%0D%0AText after new line.">create email</a>

这在RFC2368中定义,是生成换行符的唯一有效方法。

答案 1 :(得分:5)

按照RFC6068section 5)的说明,将\n(和\r\n)替换为%0D%0A,并在2010年10月更新mailto URI Scheme (替换RFC2368)。

  

[...]消息正文中的换行符必须使用"%0D%0A"进行编码   实现可以在消息正文中添加最后一个换行符   即使正文[...]

中没有尾随"%0D%0A"

这是RFC(section 6

中的示例
<mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index>

上述邮件正文对应于:

send current-issue
send index