Mailto: Email Link Tricks in HTML


We use mailto links in html that opens default mail client app in the system. Mailto takes parameters that helps to create message with relevant fields already filled out for us.

But here’s the kicker: How do we create email message with all relevant fields filled out but without recepient name? We want user to fill recepient manually.

Now: First let’s see how mailto link is constructed -

<a href=“,”>
Email Us

Common Mailto components are:

mailto:recepient@email.comRecipient address
cc=name@email.comCarbon copy e-mail address
bcc=name@email.comBlind carbon copy e-mail address
subject=subject textSubject of e-mail
body=body textBody of e-mail
?First paramter delimeter
&other parameters delimiter

Now comes the best part:

If we use wrong format it gets crazy.

Example 1:
<a href=“,”> Email Us </a>

We see in the email message all our relevant field information are assigned to recepient box. All content followed after : delimiter in mailto is assigned to receipient field until another delimter is found.

Example 2:
<a href="mailto:?,">Email Us</a>

Now see we have all relevant fields assigned with correct information. What’s the bottom line? We have to use delimiter ? after mailto: to give empty recepient value that formatter uses to understand a difference between other parameters and recepient parameter.

You might also like: CSS Hex Code Colors With Alpha Values

More Articles

Recommended posts