How to enter line break into mailto body command

Guess no one asked me this before and I didn’t run into this question yet. However, today I got approached with the question how line breaks can be entered in a mailto: command.
The answer can be found in RFC 2368 whereas line breaks in the body of a message must be encoded using the %0D%0A sequence, which in case is nothing else then hexadecimal for 10 (line feed) and 13 (carriage return).
A full mailto: command using this feature could look like this:

mailto:name@domain.e_t?subject=Header&body=This is the first line%0D%0AThis is the second

Strictly speaking should the white spaces also be replaced with the appropriate ASCII code which is %20 and makes the complete command to look like this:

mailto:name@domain.e_t?subject=Header&body=This%20is...
%20the%20first%20line%0D%0AThis
%20is%20the%20second

41 thoughts on “How to enter line break into mailto body command

  1. This came as the top search result in google when I searched for “enter in mailto” and it truely deserves it. Thanks a lot….used this instantaneously.

  2. Awesome! I’m just starting out with HTML and was really curious how to accomplish this! Thanks a lot!

  3. Hi,, It works fine with IE6 browser installed on my machine. But If IE8 is installed then every thing comes in single line without any line break.

  4. Pingback: garywaddell.com | mailto: Adding Line Breaks in the Body

  5. I thought this was correct but it doesn’t work. Could it be the newer yahoo doesn’t allows html scripted subjects to be entered? I can add html symbols but now line breaks. Any suggestions?

  6. Thank you ever so much for taking a few minutes to put this code out there.

    I have just used in in a mailer and the %0D%0A code is working perfectly

    Thank you

  7. Also works in Google spreadsheets with a mailto hyperlink containing multiline content generated by concatenating a rectangular range of cells.

    Although the hyperlink is dirty (I made no effort for proper entity escaping or even quoting) it seems to work so far, at least on Linux when clicking on the link using Firefox which calls Thunderbird for the actual mail generation.

  8. Thank you, that’s really helpful.
    The beauty of Internet, need something and here we go on a 5 years old website with the best answer.

  9. xOD being larger thant xOA, how can it come FIRST in the command string %0D%OA ?

    You mean in fact: first CR then LF.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>