3

I need to attach large textarea content to mail with following code.

location.href="mailto:a@example.com?subject=example&body="+encodeURIComponent(document.getElementById("listbox").value);

However there is a limit length for textarea characters when it exceeds, it doesn't work. I tried with variable and attach to email; however again variables have limits. How can I attach large strings to an email? Thanks for help...

user1874941
  • 3,013
  • 4
  • 20
  • 31

1 Answers1

0

You should be able to do with a POST request:

<form action="mailto:youremail@domain.com">
  <input type="hidden" name="Subject" value="Email subject">
  <input type="hidden" name="Body" value="Email body">
  <input type="submit">
</form>

Of course you can do this in js as well. By creating the DOM structure dynamically and sybmitting the form.

fredrik
  • 6,483
  • 3
  • 35
  • 45
  • Thanks for advice; however it didn't change anything. Again when the text is too long submit button doesn't work. – user1874941 Mar 21 '13 at 10:18
  • 1
    If your text is that long (probably about 1.5k) there is no workaround. This is a limitation in the HTTP specification, which is in effect even though you never leave your local computer. – fredrik Mar 21 '13 at 11:48
  • ok. I understood there is no way around for long texts. I will set this answer as my accepted answer. – user1874941 Mar 25 '13 at 13:53