Friday, 19 November 2010

Mailto special characters

If a form is not available, the next best thing is to pre-populate and email with a template of the data you want to collect.  Mailto can be used with a subject and/or a short body.  If forced down the mailto route, it can be tricky to customise the resulting email, especially as each mail client can display the email in whatever way they like.  HTML can't be used so here some useful character codes that will be needed:
Character ASCII Escape Value
Carriage return %0D
Line feed %0A
New line %0D%0A
Tab %09
Space %20
Quotes (") %22
Apostrophe (') %27
Ampersand (&) %26
Percent sign (%) %25

Example (will open in your default email client):
 Test Mail to Link...
<a href="mailto:test@mail.com?subject=This is a test?body=This is one line.%0D%0AThis is another.%0D%0A%09Padded%0D%0A%09Padded%0D%0A%09Padded%0D%0A">Test mail to link...</a>

No comments:

Post a Comment