Insert a line break in mailto body

2019-01-10 11:43发布

I would like to insert a line break into my mailto body. I tried %0A, %0D and %0D%0A. Nothing worked for me. I tested on Gmail, Yahoo, Apple Mail, Outlook 2010, Outlook.com and Thunderbird with Google Chrome on Mac OSX.

Any help please ?

Here's my code :

<a href="mailto:email@mycompany.com?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>

标签: email mailto
3条回答
对你真心纯属浪费
2楼-- · 2019-01-10 12:17

As per RFC2368 which defines mailto:, further reinforced by an example in RFC1738, it is explicitly stated that the only valid way to generate a line break is with %0D%0A.

This also applies to all url schemes such as gopher, smtp, sdp, imap, ldap, etc..

查看更多
时光不老,我们不散
3楼-- · 2019-01-10 12:19

for plaintext email - use "\r" .

like : "this is my test\rthis is my test\ryes it is"; it will give 3 lines in email, like below

line 1 : this is my test

line 2 : this is my test

line 3 : yes it is

查看更多
Deceive 欺骗
4楼-- · 2019-01-10 12:32

I would suggest you try the html tag <br>, in case your marketing application will recognize it.

I use %0D%0A. This should work as long as the email is HTML formatted.

<a href="mailto:email@mycompany.com?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>

You will likely want to take out the %20 before Firstname, otherwise you will have a space as the first character on the next line.

A note, when I tested this with your code, it worked (along with some extra spacing). Are you using a mail client that doesn't allow HTML formatting?

查看更多
登录 后发表回答