I'd like to use web form to generate an email using mailto:
,
with the subject and body specified by the user in the form.
Is this supported?
The subject and body can be specified in a regular hyperlink, like this:
mailto:a@b.c?subject=d e&body=f g
I'm testing this with Firefox and Outlook and it works fine: Outlook pre-fills the subject and body with d e
and f g
, as desired.
Of course, those spaces should really be URL-encoded:
mailto:a@b.c?subject=d%20e&body=f%20g
This works, too: spaces appear in Outlook.
(How universal is this? Can I assume it will work for 95% of my users who have their mailto
handler set up correctly?)
Now I want to supply the subject and body in form fields:
<form method="method" action="mailto:a@b.c" enctype="text/plain">
<input type="text" name="subject" value="d e">
<input type="text" name="body" value="f g">
</form>
This almost works: the spaces are replaced with plus signs. Even when I type new values in the text fields.
How can I get spaces?
(A related question: HTML mailto form: prefill subject and body.)
PS: I suppose it can be done using JavaScript to submit the form. I'm trying to avoid that.