If you want to specify anything more than just a an email address in a mailto: URL like suggesting a default subject or even a default body you have to escape certain characters.
You can't simply hit Return to break the line in a default body, for example. That would make the browser choke. You have to use funny expressions like "%20" or "%A0%B0" instead. But what do they mean, and when should you use which?
Hex Codes
The strange compilations of characters are hex codes of ASCII characters that are required to be encoded in URLs by RFC 1738 - Uniform Resource Locators (URL).
How do I know which to use when?
Here's some good news: you do not need to know how to construct these hex representations. This is where the JavaScript I promised helps out.
The JavaScript encodeURIComponent()
JavaScript knows a function called encodeURIComponent() that will encode any string it gets passed as an argument and return it for us to use. For example, encodeURIComponent("Doc, do da Dance!") produces the following:
Doc%2C%20do%20da%20Dance!
Yes, it's that obscure. If you do this cryptography by hand, chances are you will make a mistake. JavaScript will not make a mistake (fingers crossed). And here's how to use encodeURIComponent() to ease the composition of your mailto URLs:
All we need to do is to replace any occurrence of a string in our URL with the function "encodeURIComponent()" which gets our string as an argument.
For example: we want to create a mailto URL that initiates a message to recipient@example.com with a subject of "When, when is now? (if "now" is here)". Basically, the URL will look like this:
mailto:recipient@example.com?subject=<subject>
where <subject> is our string "When, when is now? (if "now" is here)". The string as an argument to encodeURIComponent() makes the following: encodeURIComponent("When, when is now? (if \"now\" is here)"). The result of this function call is:
When%2C%20when%20is%20now%3F%20(if%20%22now%22%20is%20here)
You probably have wondered whence the backslashes came. Their job is escaping the quotation marks used to enclose a string. If a quotation sign appeared within a string without being escaped the interpreter would read this as the end of the string — and be confused (try it).
Now what does our URL look like in its full glory if we put the escaped expression where the <subject> was?
mailto:recipient@example.com?subject=encodeURIComponent("When, when is now? (if \"now\" is here)")
That's the theory. Unfortunately, realiter it does not work. What's wrong?
The JavaScript interpreter is not called to do the escaping for us, the browser simply reads whatever comes after "subject=" as the subject and puts it in the Subject: line.
Using encodeURIComponent() with mailto URLs
Yet we can use encodeURIComponent() in a mailto URL. All we need to do is compose the whole link (from "<a href=..." to "</a>") within the JavaScript function document.write(), which will, incidentally, write any text to the document, just as if we had typed it in the HTML source.
I guess an example says more than 1001 words here (the line breaks are here only to ensure proper formatting of this page; you would write all the code into one single line):
<script language="JavaScript"><document.write("<a href=\"mailto:recipient@example.com?subject=" + encodeURIComponent("When, when is now? (if \"now\" is here)") + "\">mail me!</a>")</script>
With <script language="JavaScript"> we call the JavaScript interpreter. We tell it to write() something at current position in the document; something which is composed of three parts. First, the beginning of a mailto link as we know it. Then comes the interesting part, our escaped string. And finally comes the ending tag.

