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

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

  1. OK after then &body command in an email I want to prime the cursor to the second line, so as not to overwrite my body.

  2. Great post, very helpful. Are there any other ‘bits’ like this for hyperlinks that do things like make text bold or italic??

  3. Pingback: How to encode special chars in mailto header information | jejanim's Blog!

  4. It’s a very helpful post. %0D%0A works well in Outlook and Gmail, but it doesn’t seem to work in Yahoo mail and Aol. Any tips on that? Thanks!

  5. Amazing. Such a simple but user friendly thing to be able to do. Thanks a lot.

  6. Hi all,
    I’m trying to send an email notification from an Orchestrator tool using JavaScript. The content in the email comes all jumbled up in a single line (see example below). Any idea on how to do line break here:

    content = “Operating System :” +guestos +
    “VM Name :” +vmName +
    “Template Name :” +tempName +
    “CPU Count :” +cpuCount +
    “Memory Size :” +memSize +
    “Datastore Name :” +datastoreName +
    “Disk Size :” +diskSize +
    “Network Name :” +networkName +
    “Host ID :” +hostId +
    “MAC address :” +macAddress;

    Operating System:rhel6_64GuestVM Name:vcac191Template Name:Test-QA-CentOS65_x64CPU Count:1Memory Size:4096Datastore Name:TESTLAB01-VMXDisk Size:75Network Name:HadoopTestHost ID:testvca02.abc.net/West Test Lab/host/test01MAC address:00:00:00:00:00:00

    Thanks,
    Tony

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=""> <s> <strike> <strong>