Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML: insert line-break in email subject like %20 is a space?

Tags:

html

email

BreakHere…

I wonder if it is possible to write something like %20 (which stands for a space) for a line-break as well. So I want to have seperate lines in my body of the e-mail.

Any ideas?

like image 968
matt Avatar asked Feb 22 '13 08:02

matt


People also ask

How do you put a line break in an email body in HTML?

Use Encoding %0D%0A in mailto body to line break. This is the only valid way to generate a line break of content/text in the body.

What is used to insert a line break in HTML?

The <br> HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant.

How do you insert a break in line?

To add spacing between lines or paragraphs of text in a cell, use a keyboard shortcut to add a new line. Click the location where you want to break the line. Press ALT+ENTER to insert the line break.


2 Answers

You should use a carriage return %0D and line feed %0A

<a href="mailto:[email protected][email protected]&subject=your subject&body=Text before new line.%0D%0AText after new line.">create email</a> 

This is defined in RFC2368 and is the only valid method of generating a line-break.

like image 195
MikroDel Avatar answered Sep 21 '22 09:09

MikroDel


Replace \n (and \r\n) by %0D%0A as specified by RFC6068 (in section 5) updating the mailto URI Scheme as of October 2010 (replacing RFC2368).

[...] line breaks in the body of a message MUST be encoded with "%0D%0A".
Implementations MAY add a final line break to the body of a message even if there is no trailing "%0D%0A" in the body [...]

This is the example from the RFC (in section 6)

<mailto:[email protected]?body=send%20current-issue%0D%0Asend%20index> 

The above mail body corresponds to:

send current-issue send index 
like image 35
oHo Avatar answered Sep 20 '22 09:09

oHo