The mailto URL scheme is used to designate the Internet mailing address of an individual or service. In its simplest form, a mailto URL contains an Internet mail address which upon clicking will launch the default mailing software on the computer.
Sometimes we also require the message headers and body to populated as well, mailto syntax can also be used for that. Mailto command is generally used to link to a single email address but there is much more Mailto can do..
Basic Syntax :-
mailtoURL = "mailto:" [ to ] [ headers ] to = #mailbox headers = "?" header *( "&" header ) header = hname "=" hvalue hname = *urlc hvalue = *urlc **Note :- Within mailto URLs, the characters "?", "=", "&" are reserved.
Some Other Lesser Known Mailto Syntax :-
Mailto Link To A Single Address :-
Mailto Link To Multiple Addresses :-
<a href=“mailto:firstname.lastname@example.org, email@example.com”>
By looking at the syntax above you would have got the idea that we can send the same mail to multiple persons by seperating the addresses using comma operator.
Mailto Link With Pre-Populated CC and BCC Fields :-
Mailto Link With Pre-Populated Subject Field :-
In the syntax above if you want to include a space in your subject field then use %20 as whitespaces are automatically truncated.
Mailto Link With Pre-Definded Subject And Body Fields :-
These were some of the lesser known mailto syntax’s you can use on your webpage. Do provide feedback or share this post if you like the information on this article. Cheers..