now you are able to send mails; not fully functional yet

This commit is contained in:
Klaus Leithoff 2013-10-05 09:47:34 +00:00
parent 9b9a1df8a3
commit 82dcae783a
3 changed files with 28 additions and 11 deletions

View File

@ -3038,7 +3038,7 @@ class mail_bo
if ($_charset===false) $_charset = self::$displayCharset; if ($_charset===false) $_charset = self::$displayCharset;
$_stringORG = $_string; $_stringORG = $_string;
$_string = @htmlspecialchars($_string,ENT_QUOTES,$_charset, false); $_string = @htmlspecialchars($_string,ENT_QUOTES,$_charset, false);
if (empty($_string) && !empty($_stringORG)) $_string = @htmlspecialchars(translation::convert($_stringORG,self::detect_encoding($_stringORG),$_charset),ENT_QUOTES | ENT_IGNORE,$_charset, false); if (empty($_string) && !empty($_stringORG)) $_string = @htmlspecialchars(translation::convert($_stringORG,translation::detect_encoding($_stringORG),$_charset),ENT_QUOTES | ENT_IGNORE,$_charset, false);
return $_string; return $_string;
} }
@ -4933,6 +4933,11 @@ class mail_bo
return $bytes . ' ' . $type ; return $bytes . ' ' . $type ;
} }
static function detect_qp(&$sting) {
$needle = '/(=[0-9][A-F])|(=[A-F][0-9])|(=[A-F][A-F])|(=[0-9][0-9])/';
return preg_match("$needle",$string);
}
/** /**
* checkFileBasics * checkFileBasics
* check if formdata meets basic restrictions (in tmp dir, or vfs, mimetype, etc.) * check if formdata meets basic restrictions (in tmp dir, or vfs, mimetype, etc.)

View File

@ -358,16 +358,28 @@ $CAtFStart = array2string($_content);
$sendOK = true; $sendOK = true;
try try
{ {
$_content['body'] = ($_content['body'] ? $_content['body'] : $_content['mail_'.($_content['mimeType'] == 'html'?'html':'plain').'text']);
$success = $this->send($_content);
if ($success==false)
{
$sendOK=false;
$message = $this->errorInfo;
}
} }
catch (egw_exception_wrong_userinput $e) catch (egw_exception_wrong_userinput $e)
{ {
$sendOK = false; $sendOK = false;
$message = $e->getMessage();
} }
if ($sendOK) if ($sendOK)
{ {
egw_framework::refresh_opener(lang('Message send successfully.'),'mail'); egw_framework::refresh_opener(lang('Message send successfully.'),'mail');
egw_framework::window_close(); egw_framework::window_close();
} }
if ($sendOK == false)
{
egw_framework::refresh_opener(lang('Message send failed: %1',$message),'mail');
}
} }
if ($_content['button']['saveAsDraft']) if ($_content['button']['saveAsDraft'])
{ {
@ -1067,7 +1079,7 @@ $CAtFStart = array2string($_content);
if ($addressObject->host == '.SYNTAX-ERROR.') continue; if ($addressObject->host == '.SYNTAX-ERROR.') continue;
$address = imap_rfc822_write_address($addressObject->mailbox,$addressObject->host,$addressObject->personal); $address = imap_rfc822_write_address($addressObject->mailbox,$addressObject->host,$addressObject->personal);
//$address = mail_bo::htmlentities($address, $this->displayCharset); //$address = mail_bo::htmlentities($address, $this->displayCharset);
$content[strtoupper($destination)][]=$address; $content[strtolower($destination)][]=$address;
$destinationRows++; $destinationRows++;
} }
} }
@ -1077,13 +1089,13 @@ $CAtFStart = array2string($_content);
{ {
$content = array_merge($content,$_content); $content = array_merge($content,$_content);
if (!empty($content['FOLDER'])) $sel_options['FOLDER']=$this->ajax_searchFolder(0,true); if (!empty($content['folder'])) $sel_options['folder']=$this->ajax_searchFolder(0,true);
$content['SENDER'] = (empty($content['SENDER'])?($selectedSender?(array)$selectedSender:''):$content['SENDER']); $content['sender'] = (empty($content['sender'])?($selectedSender?(array)$selectedSender:''):$content['sender']);
} }
else else
{ {
//error_log(__METHOD__.__LINE__.array2string(array($sel_options['SENDER'],$selectedSender))); //error_log(__METHOD__.__LINE__.array2string(array($sel_options['SENDER'],$selectedSender)));
$content['SENDER'] = ($selectedSender?(array)$selectedSender:''); $content['sender'] = ($selectedSender?(array)$selectedSender:'');
//error_log(__METHOD__.__LINE__.$content['body']); //error_log(__METHOD__.__LINE__.$content['body']);
} }
$content['is_html'] = ($content['mimeType'] == 'html'?true:''); $content['is_html'] = ($content['mimeType'] == 'html'?true:'');

View File

@ -6,7 +6,7 @@
<vbox class="mailCompose mailComposeHeaderSection" width="100%"> <vbox class="mailCompose mailComposeHeaderSection" width="100%">
<hbox class="mailComposeHeaders" width="99%"> <hbox class="mailComposeHeaders" width="99%">
<description value="Identity"/> <description value="Identity"/>
<taglist-email id="SENDER" width="88%" allowFreeEntries="false" maxSelection="1" autocomplete_url="mail.mail_compose.ajax_searchIdentities" onclick="app.mail.address_click"/> <taglist-email id="sender" width="88%" allowFreeEntries="false" maxSelection="1" autocomplete_url="mail.mail_compose.ajax_searchIdentities" onclick="app.mail.address_click"/>
</hbox> </hbox>
<hbox> <hbox>
<button label="Send" id="button[send]"/> <buttononly value="saveAsDraft" id="button[saveAsDraft]" image="fileexport" onclick="app.mail.saveAsDraft"/> <button label="Send" id="button[send]"/> <buttononly value="saveAsDraft" id="button[saveAsDraft]" image="fileexport" onclick="app.mail.saveAsDraft"/>
@ -15,23 +15,23 @@
</hbox> </hbox>
<hbox class="mailComposeHeaders" width="99%"> <hbox class="mailComposeHeaders" width="99%">
<description value="To"/> <description value="To"/>
<taglist-email id="TO" width="88%" onclick="app.mail.address_click"/> <taglist-email id="to" width="88%" onclick="app.mail.address_click"/>
</hbox> </hbox>
<hbox class="mailComposeHeaders" width="99%"> <hbox class="mailComposeHeaders" width="99%">
<description value="Cc"/> <description value="Cc"/>
<taglist-email id="CC" width="88%" onclick="app.mail.address_click"/> <taglist-email id="cc" width="88%" onclick="app.mail.address_click"/>
</hbox> </hbox>
<hbox class="mailComposeHeaders" width="99%"> <hbox class="mailComposeHeaders" width="99%">
<description value="Bcc"/> <description value="Bcc"/>
<taglist-email id="BCC" width="88%" onclick="app.mail.address_click"/> <taglist-email id="bcc" width="88%" onclick="app.mail.address_click"/>
</hbox> </hbox>
<hbox class="mailComposeHeaders" width="99%"> <hbox class="mailComposeHeaders" width="99%">
<description value="Reply To"/> <description value="Reply To"/>
<taglist-email id="REPLYTO" width="88%" maxSelection="1" onclick="app.mail.address_click"/> <taglist-email id="replyto" width="88%" maxSelection="1" onclick="app.mail.address_click"/>
</hbox> </hbox>
<hbox class="mailComposeHeaders" width="99%"> <hbox class="mailComposeHeaders" width="99%">
<description value="Store to Folder"/> <description value="Store to Folder"/>
<taglist id="FOLDER" width="88%" autocomplete_url='mail.mail_compose.ajax_searchFolder' autocomplete_params='' allowFreeEntries="false" onclick="app.mail.address_click"/> <taglist id="folder" width="88%" autocomplete_url='mail.mail_compose.ajax_searchFolder' autocomplete_params='' allowFreeEntries="false" onclick="app.mail.address_click"/>
</hbox> </hbox>
<hbox class="mailComposeHeaders" width="99%"> <hbox class="mailComposeHeaders" width="99%">
<description value="Subject"/> <description value="Subject"/>