Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The data area passed to a system call is too small"

Is there a certain string size for outlook email. I have the following code that gives me an error

The data area passed to a system call is too small

However this only seems to occur when my message body is larger then normal

document.location.href = "mailto:" + emailAddress + "?subject=my msgs Relief&body=" + escape(message);

If I am removing code then it's not showing this message. So it seams that it's related to the number of characters in email body. Please suggest.

like image 626
R Chaudhary Avatar asked Nov 02 '12 07:11

R Chaudhary


1 Answers

I recently came across this exact problem. The issue is that different browsers (and different email clients) have limits on the amount of data that can be passed between them using mail-to links.

For example, the maximum URL length in Internet Explorer is 2,083 characters (MS KB Link). If the total length of your link including the subject, address, and body exceeds this, you will get exactly this error.

To fix this (as we have to support IE), I used this kludge after generating my link:

var mailto_link = 'mailto:'+addresses+'?subject='+subject+'&body='+body_message;
win = window.open(mailto_link.substr(0,2000),'emailWindow');

It's not perfect, but on the rare occasions the user tries to generate an enormous notification email, they are politely warned first, reminded during, and notified after the event.

like image 111
kieran_delaney Avatar answered Oct 16 '22 23:10

kieran_delaney