From be96b786b7643d394a8beaf7a05187f66141d549 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 29 May 2015 11:04:56 +0000 Subject: [PATCH] Fix sending many mails from AB to mail compose causes url length limitation error in IE --- phpgwapi/js/jsapi/egw_open.js | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/phpgwapi/js/jsapi/egw_open.js b/phpgwapi/js/jsapi/egw_open.js index d9f28c6aef..6f1571edef 100644 --- a/phpgwapi/js/jsapi/egw_open.js +++ b/phpgwapi/js/jsapi/egw_open.js @@ -55,19 +55,36 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) cc: match['cc'] || [], bcc: match['bcc'] || [] }; - + var popup; // Get open compose windows var compose = egw.getOpenWindows("mail", /(^compose_)||(^mail.compose)/); if(compose.length == 0) { // No compose windows, might be no mail app.js // We really want to use mail_compose() here - egw.open('','mail','add',{'preset[mailto]': uri},'compose__','mail'); + + // Accoring to microsoft, IE 10/11 can only accept a url with 2083 caharacters + // therefore we need to send request to compose window with POST method + // instead of GET. We create a temporary
and will post emails. + if (uri.length > 2083) + { + popup = egw.open('','mail','add','','compose__','mail'); + popup.onload = function(){ + var emails = uri.replace('mailto:',''); + // Build a temp Form and submit right away + jQuery('\n\ +
').submit(); + }; + } + else // simple GET request + { + egw.open('','mail','add',{'preset[mailto]': uri},'compose__','mail'); + } } if(compose.length == 1) { try { - var popup = egw.open_link('',compose[0],'100x100','mail'); + popup = egw.open_link('',compose[0],'100x100','mail'); popup.app.mail.setCompose(compose[0], content); } catch(e) { // Looks like a leftover window that wasn't removed from the list