This article was previously published under Q279460
This article has been archived. It is offered "as is" and will no longer be updated.
The sample code provided in this article applies to developers that want to submit the contents of an HTML form directly to an e-mail address. The code also applies to developers who run into the length limitations documented later in this article when using the mailto: protocol in other situations. For the latter case, the body text is often the limiting factor.
For more information about length limitations, see the articles listed in the "References" section.
NOTE: Use of the approach outlined in the "More Information" section has several limitations, including:
The other tags could exceed the maximum URL limitation by themselves. For instance, if there are a number of "To:" and "CC" recipients.
A security popup when the user submits the FORM, as documented in the mailto protocol RFC, RFC2368.
Internet Explorer uses MAPI to communicate with the default mail application. The e-mail client installed on the client computer must be MAPI-compliant. Microsoft Outlook and Outlook Express behave as described within.
The e-mail client must have made the appropriate registry entries for this to work.For more information about the registry entries, click the following article number to view the article in the Microsoft Knowledge Base:
154359 How to change the default mail client for Internet Explorer
The more robust approach, which does not have the mailto: protocol limitations, is to submit the FORM to an ASP/CGI script on a Web server. The script packages the data into an e-mail message. For an example about how to do this by using ASP and Collaboration Data Objects (CDO), refer to following Microsoft Knowledge Base article:
186204 How to use CDONTS to collect and mail information from a user
One solution is using a FORM with an ACTION of POST instead. The caveat is that FORM elements cannot be used to fill in the various fields like Subject, Body, and and so forth because the mailto: protocol handler does not examine these fields. All the FORM data is packaged and e-mailed away.
So, having the FORM ACTION fills in the Subject field as follows
This is because the default ENCTYPE attribute for the FORM element is "application/x-www-form-urlencoded". To e-mail data in plain-text format instead, explicitly specify an ENCTYPE attribute of "text/plain". For instance: