views:

371

answers:

3

I've got a HTML form with a lot of input fields, which I use to populate an email. I learned today that using the GET-method will limit the size of what's posted. But from what I can tell, there is no limit when using POST. Well, there probably is since I believe that this is probably my problem. My emails aren't opening in the email client when they have reached a certain size (or if I've used too many input fields?)

The users will not be able to have a constant internet connection, and the only "reliable" method to communicate is via email. They are limited in their usage of their computer and can't runt any executable files. That's why I created a HTML file with a lot of javascript that creates the email body. Some of the users have got an email client, and if that's the case I want to open a new email with the content from the form on the HTML file.

So, is there some kind of limit of how big the body can be when sending a form with action="mailto:"?

+1  A: 

You are limited to 2083 characters total when using GET on IE. This applies to everything that uses GET.

voyager
+2  A: 

Tested on Firefox 3.5.8, I could only cram 1994 characters into a POST form when using action="mailto:". Generally you want to avoid using mailto: with a body parameter.

Perhaps just have them copy/paste the body of a generated email into their client manually. It's extremely crude, but sometimes you have to improvise....

Warren
Also it appears that IE returns an error complaining that "the default mail client is not properly installed" for fields of this length.
Warren
That's the error message that got me wondering what was going on. Hmm, so the max amount of characters is ~2000. That means it's generally the same as when using GET. Is there any limit when sending a form using POST, but not with action="mailto:"? I guess you can't tell the browser to extend the limit somehow?I've got the body available for copy/paste, but that just seems so not user friendly.
thorseye
I believe that the size of a POST request is normally limited by your server's configuration (different servers have different defaults). You mentioned that you don't have consistent Internet access to work with, does your server have the ability to send email directly? You could consider using a scripting language like PHP to send the email for the user, rather than opening the email client for them.You shouldn't run into any problems with POST length if you're just using an action page to process the request (assuming your email isn't 20MB of text).
Warren
+1  A: 

To add to what voyager said: also on FF the limit of the URL length is similar.

But th best way is to test it, because fo instance on IE8 I noticed that if the url is 2080 /which fits in the 2083 max length( it still does not work with the mailto protocol)

You can do these kind of tests easily by adding in a page an url in the form

<a href="mailto:[email protected]?subject=Hello&amp;body=Babe">click to send mail</a>

if the total length of the href value is greater than a certain length (about 2083, but it's less than this), when clicking on the url you will see that the browser won't even attempt to open the mail. This is not only for IE (6/7/8 at least), but also for FF (3.6 at least).

Marco Demajo