Limit on mail body when posting a mailto: form

2019-02-25 06:40发布

问题:

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:

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....



回答2:

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



回答3:

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:xx@xy.com?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).