using mailto: body limit

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Poulos

    using mailto: body limit

    I'm using the following code to fill an email for the user to send:

    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?

    Andrew Poulos
  • Bart Van der Donck

    #2
    Re: using mailto: body limit

    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:
    Support for Internet Explorer 11 has ended on June 15, 2022. Make the switch to Microsoft Edge to experience the web in a whole new way.


    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

    Comment

    • Stevo

      #3
      Re: using mailto: body limit

      Bart Van der Donck wrote:
      >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
      The escape will significantly increase the size too. In this case I'd
      add an alert with the length of the string just before trying to use it.

      Comment

      Working...