Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
How to use the mailto: protocol in a <FORM> action
Article ID: 279460 - View products that this article applies to.
This article was previously published under Q279460
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:
(http://support.microsoft.com/kb/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
while having the FORM ACTION illustrated here does not:
In both cases, the FORM data is e-mailed in as an Attachment, in an encoded format. For instance, in the preceding case, this is how the data looks:
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:
produces the following Body:
Subject=Test Subject Body= kfdskfdksfkds
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/196461/ )How to set up a form to post results by e-mail in FrontPage 2000
194088For more information about character limitations, click the following article numbers to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/194088/ )How to set up a form to post results by e-mail in FrontPage 98
(http://support.microsoft.com/kb/208427/ )Maximum URL length is 2,083 characters in Internet Explorer
263909For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
(http://support.microsoft.com/kb/263909/ )ShellExecuteEx limits URL to MAX_PATH
Article ID: 279460 - Last Review: April 28, 2012 - Revision: 5.0