Mailto: Email Link Tricks in HTML
byWe 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=“mailto:recepient@email.com?cc=first@email.com, second@email.com&bcc=gossip@email.com&subject=blah”>
Email Us
</a>
Common Mailto components are:
mailto:recepient@email.com | Recipient address |
cc=name@email.com | Carbon copy e-mail address |
bcc=name@email.com | Blind carbon copy e-mail address |
subject=subject text | Subject of e-mail |
body=body text | Body of e-mail |
? | First paramter delimeter |
& | other parameters delimiter |
Now comes the best part:
If we use wrong format it gets crazy.
<a href=“mailto:cc=first@email.com, second@email.com&bcc=gossip@email.com&subject=blah&body=body”>
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.
<a href="mailto:?cc=first@email.com, second@email.com&bcc=gossip@email.com&subject=blah&body=body">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