Andrew Poulos wrote:
var t = escape(t); // to
var s = escape(s); // subject
var b = escape(b); // body
var doc = "mailto:" + t + "?subject=" + s +"&body=" + b;
window.location = doc;
If works fine until the length of 'b' gets over about 255 character,
then I get an "invalid syntax" error at the last line. Is there a
limit on the size of the body text for an email in this case?
I think it's not the size of your 'b'-variable that matters, but the
size of the total URI; in your case, the 'doc'-variable. As per my
test on Vista MSIE 7.0.6. and FireFox 2.0.0.12., I don't see any
problems here as long as the full URI remains below 2K. Probably this
is enforced by the email client (in my case Windows Mail 6.0.6.) and
not by the browser.
Allowed URI size in Windows:
http://support.microsoft.com/kb/208427
On the other hand,
http://www.ietf.org/rfc/rfc2068.txt advises maximum
backwards compatibility, quote:
| Servers should be cautious about depending on URI lengths above
| 255 bytes, because some older client or proxy implementations
| may not properly support these lengths.
Maybe some email clients could block after a certain URI-length too. I
wouldn't rely on mailto-protocols over 255 under production conditions
anyhow.
Hope this helps,
--
Bart