I have run into some problems with emailing a file from flex. I currently use the code below. If bodyVar is fewer than 1967 then the email is populated fine. When i call this code an Outlook message opens containing whatever is in bodyVar. If it is more than 1967 then it opens with a blank page.
var mailMsg:URLRequest = new URLRequest("mailto:");
var variables:URLVariables = new URLVariables();
variables.subject = subVar;
variables.body = bodyVar;
mailMsg.data = variables;
mailMsg.method = URLRequestMethod.GET;
navigateToURL(mailMsg, "_self");
I am using Firefox and I presume this 1967 is coming from that. If I used IE then the email does not even open.
Does anyone know of a way of sending an email in flex which allows me to send a lot of text? I am not bothered by formatting or images etc. I just need to be able to send text
Thanks
EDIT
I have just found this bit of code that shows another way without using URLVariables object. I presume the limitation here is in http
var s:String = "";
s += "mailto:";
s+= sendTo.text;
s+= "?";
s+= "subject=";
s+= subjectVar;
s+= "&";
s+= "body=";
s+= bodyVar;
navigateToURL(new URLRequest(s));
EDIT 2
To be clear I want to open a new email message using the user’s email client. So if they have outlook installed I would like an Outlook msg opened containing text that should be sent.
I ran into this exact thing a while back. After some deep digging I discovered the issue:
The problem is that Outlook (like Internet Explorer) has a URI character limit of 2048 characters (total length which is why you are getting cut off). Outlook also has a max recipient length of 75 recipients.
So your hard limit is coming from outlook. I would assume that the reason it performs differently when Firefox is set as the default browser is because firefox supports WAY more characters than internet explorer. So it will make it through firefox… then die at outlook. But when you use IE, it dies at IE since they have the same small char limit.
The reason it shows up blank is because once one of these limits are hit, the browser converts mailto:long string into mailto:”” (an empty string).
I would recommend:
a) forcing the character limits in the UI to stay small
b) using a server side script to send the emails instead.
Here is a link that shows all of the different browsers and email clients and their corresponding character limits Link to Limits Page