我想在我的mailto正文中插入换行符。我尝试了%0A,%0D和%0D%0A。什么都没有为我工作。我在Mac OSX上使用Google Chrome在Gmail,Yahoo,Apple Mail,Outlook 2010,Outlook.com和Thunderbird上进行了测试。
请帮助吗?
这是我的代码:
<a href="mailto:[email protected]?subject=Subscribe&body=Lastame%20%3A%0D%0A%20Firstname%20%3A"><img alt="Subscribe" class="center" height="50" src="subscribe.png" style="width: 137px; height: 50px; color: #4da6f7; font-size: 20px; display: block;" width="137"></a>
[我建议您尝试使用html标签<br>
,以防您的营销应用程序识别出它。
我使用%0D%0A
。只要电子邮件是HTML格式的,它就应该起作用。
<a href="mailto:[email protected]?subject=Subscribe&body=Lastame%20%3A%0D%0AFirstname%20%3A"><img alt="Subscribe" class="center" height="50" src="subscribe.png" style="width: 137px; height: 50px; color: #4da6f7; font-size: 20px; display: block;" width="137"></a>
您可能想在名字前取出%20,否则下一行的第一个字符为空格。
注意,当我用您的代码对其进行测试时,它可以正常工作(还有一些额外的间距)。您使用的邮件客户端不允许HTML格式吗?
奇怪的是,在gmail中,对于Android %0D%0A
无效,<br>
有效:
<a href="mailto:[email protected]?subject=This%20is%20Subject&body=First line<br>Second line">
click here to mail me
</a>
对于纯文本电子邮件-使用“ \ r”。
例如:“这是我的测试\ r这是我的测试\黑麦是”它将在电子邮件中显示3行,如下所示
第1行:这是我的测试
第2行:这是我的测试
第3行:是的