action="mailto:"

>From <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2007-January/009210.html>.

<form action="mailto:" method="get">
    <input name="subject" value="1 2">
    <input type="submit">
</form>

When you submit that form in IE or FF (Opera's handling of
action="mailto:" is currently broken. Not sure about Safari),
"mailto:?subject=1+2" will be passed to the mailto client and you will
get 1+2 in the subject field of the mail client's compose window.

In mailto URIs, a + is a +. It is not decoded to a space by mail
clients. So, in order for the value to come out right in the mail
client's subject field, spaces should be encoded as %20 instead.

<http://tools.ietf.org/html/draft-duerst-mailto-bis> is the newest
unofficial mailto URI spec that is supposed to update RFC2368.

Is there a use for encoding spaces as + instead of %20 for action="mailto:"?

If not, I think it should be allowed for browsers to submit spaces as
%20 instead in this case.

<http://www.whatwg.org/specs/web-forms/current-work/#for-mailto>
doesn't clarify at the moment.

Also, different things happen for post:

<form action="mailto:" method="post">
    <input name="subject" value="1 2">
    <input type="submit">
</form>

When you submit that form (in FF for example),
"mailto:?subject=Form%20Post%20from%20Firefox&body=subject%3D1%2B2"
will be passed to the mail client.  This results in "Form Post from
Firefox" as the subject and "subject=1+2" as the body value.

WF2 describes this partially, but what's the use-case for putting the
encoded data set in the body?

There's also this case:

<form action="mailto:?subject=5" method="post">
    <input name="subject" value="1 2">
    <input type="submit">
</form>

Since the method is post, subject=5 is not replaced and
"mailto:?subject=Form%20Post%20from%20Firefox&subject=5&body=subject%3D1%2B2"
is passed to the client. This results in 5 being in the subject field
instead of "Form POST from UA" (For mail clients that support
duplicate hnames at least
<http://shadow2531.com/opera/testcases/mailto/rfc2368-3.html>).

There's a little more to the handling with POST. See
"HTMLFormElement.prototype.mailto_createURIFromData" in
<http://shadow2531.com/js/mailto_prototypes1.zip> for an example of
how FF does it with POST. (The TCs in the zip file should be loaded
with JS off to see how the browser normally does it. Try with
Thunderbird latest trunk as the default email clent for example so FF
passes to it.)

In short, if POST for mailto: is going to be defined, there needs to
be a lot more detail in how the mailto URI is generated.

Also, what should happen with other method= values?

<http://www.w3.org/TR/xforms/slice11.html#submit-options> doesn't
really seem to clarify either.

For action="mailto:", not knowing the use-cases for other methods
besides GET, it seems to me that no matter what the method is, it
should work like GET and spaces should be encoded as %20 instead. It
seems to be the only way to make action="mailto:" useful.

-- 
Michael

Received on Friday, 18 May 2007 20:06:42 UTC