Email Templates and MailTo Syntax

The mailto prefix in hyperlinks.  Everyone knows about it, everyone uses it.  Not very many people are aware however that it can do more than just pass an email address to your user’s favorite email program. 

I was in a situation the other day where I needed to prompt a user for specific information, but I did not want / need to go to the effort of writing a contact form.  Yes, I realize writing a contact form would have only taken a few minutes, but sometimes being a little bit lazy can work out well. 

So, just to remind everybody and give us a starting place, let’s create a basic mailto link

<a href="">Contact Us</a>  

First, let’s look at adding in more than just s single address.  There are two options here.  We can simply add multiple addresses divided by commas, or we can specify CC and BCC.

<a href=", [">Contact](”>Contact) Us</a>

<a href="">Contact Us</a>

<a href="">Contact Us</a>  

Now, let’s take a look at passing through a subject.  It is essentially the same principle as the CC and BCC options.

<a href=" write me back">Contact Us</a>  

Finally, the body of the email.  This is where my unwillingness to write a contact form comes into play.

<a href=" Body Content">Contact Us</a>  

I can hear you now, that’s great, but what if I want more complicated substance to my email body?  What if I need multiple paragraphs.  Well, you can do that, but it is not completely supported in every email client yet.  All of the more recent iterations of the email clients should have no issues however.  The trick to passing paragraph information is obviously URL encoding a line break.  You can accomplish this by placing %0A where you would like a line break.  Extrapolating that, %0A%0A would give us a paragraph break.  Let’s look at an example.

<a href=" Paragraph One%0A%0ASample Paragraph Two">Contact Us</a>  

Ok.  We’ve looked at all the options, so, now we can chain all of these together into our Contact Form link.  To chain multiple items together, utilize the & character just like you would in a URL.

<a href=" write me back&body==Sample Paragraph One%0A%0ASample Paragraph Two">Contact Us</a>  

There you have it.