|Book contents||The HTML 4.0 Sourcebook|
This page is an edited version of a document originally authored by Jaimie Zawaniski of Netscape Inc. Any errors, of course, are mine (Ian Graham)
Netscape 2.0 and newer support an experimental new syntax in mailto: URLs. This is not a part of any standard, and subject to change in the future, so users of this new syntax should be aware of the portability problem implicit in it.
The Netscape-specific syntax goes something like this:
URL := 'mailto:' [ ADDRS ] [ HEADERS ] ADDRS := [ ADDR [ ',' ADDR ]* ] ADDR := <RFC822 `mailbox', hex-encoded if necessary> HEADERS := '?' HNAME '=' HVALUE [ '&' HNAME '=' HVALUE ] HNAME := <a mail header name; currently we only support those headers which you can edit in a mail composition window, but it would be sensible to allow other headers as well (with an exclusion list of "dangerous" headers.)> HVALUE := <contents of the header, hex-encoded if necessary>
This allows a URL to initialize the contents of a mail composition window; for example, you could put a URL in a document like
and when the user clicked on it, there would be a default subject waiting for them.
We also support this syntax when using a mailto as the POST address of a form submission; but in that case, we allow all headers, even unknown ones, to be generated, except for "dangerous" headers. These are the headers that form submissions cannot set or override the default values of:
<FORM METHOD=POST ENCTYPE=text/plain ACTION="mailto:no-such-address?Subject=neato&X-Random-Header=yow"> <INPUT TYPE=TEXT NAME=disposition VALUE="hey, cool"> <INPUT TYPE=submit VALUE="Send Mail"> </FORM>
The drawback to extending mailto: in this way is that it's not backward-compatible; browsers which only understand the older syntax (Netscape 1.1 among them) will take all that junk and dump it in the "to" field, leaving the user with an illegal mail address which they need to clean up.
Somewhere there is a proposal floating around to extend the A tag such that one could do
<A HREF="mailto:jwz" TITLE="subject of the message">
but that means you need to pass around HTML to do the job, rather than simply a URL. Also, this only handles the case of the subject header; to handle other fields, one would have to either allow arbitrary stuff in the A tag (obviously a bad idea) or use a format like
<A HREF="mailto:jwz" HEADERS="...all the headers, encoded somehow...">
That all seemed much more awkward, which is why I did it this way.
There is currently no mechanism to specify a default body of the message, though that would be nice; when we add this ability, we will probably do it by adding a body= parameter to the URL (treating the body as a sort of pseudo-header.)
Some folks in the IETF-822 and MHTML working groups have suggested that ; would be a better delimiter than the & that we use today. Once there is some actual standards-body effort toward expanding the syntax of the mailto URL in this direction, we will do whatever the standard body decides.