implement/adapt appending message to mailbox

This commit is contained in:
Klaus Leithoff 2013-11-21 11:10:31 +00:00
parent bb56c0aa45
commit 0e765f8566
2 changed files with 18 additions and 9 deletions

View File

@ -4607,12 +4607,21 @@ class mail_bo
*/
function appendMessage($_folderName, $_header, $_body, $_flags)
{
//error_log(__METHOD__.__LINE__."$_folderName, $_header, $_body, $_flags");
$header = ltrim(str_replace("\n","\r\n",$_header));
$body = str_replace("\n","\r\n",$_body);
$messageid = $this->icServer->appendMessage("$header"."$body", $_folderName, $_flags);
if ( PEAR::isError($messageid)) {
if (self::$debug) error_log("Could not append Message:".print_r($messageid->message,true));
throw new egw_exception_wrong_userinput(lang("Could not append Message:".array2string($messageid->message)));
if (!is_array($_flags) && stripos($_flags,',')!==false) $_flags=explode(',',$_flags);
if (!is_array($_flags)) $_flags = (array) $_flags;
try
{
$dataNflags = array();
$dataNflags[] = array('data'=>array(array('t'=>'text','v'=>"$header"."$body")), 'flags'=>array($_flags));
$messageid = $this->icServer->append($_folderName,$dataNflags);
}
catch (Exception $e)
{
if (self::$debug) error_log("Could not append Message:".$e->getMessage());
throw new egw_exception_wrong_userinput(lang("Could not append Message:".$e->getMessage));
//return false;
}
//error_log(__METHOD__.__LINE__.' appended UID:'.$messageid);

View File

@ -1855,7 +1855,7 @@ class mail_compose
{
$mail_bo = $this->mail_bo;
$_mailObject->PluginDir = EGW_SERVER_ROOT."/phpgwapi/inc/";
$activeMailProfile = $this->preferences->getIdentity($this->mail_bo->profileID, true);
$activeMailProfile = array();//$this->preferences->getIdentity($this->mail_bo->profileID, true);
$_mailObject->IsSMTP();
$_mailObject->CharSet = $this->displayCharset;
// you need to set the sender, if you work with different identities, since most smtp servers, dont allow
@ -2184,8 +2184,8 @@ class mail_compose
$messageIsDraft = true;
}
#error_log(print_r($this->preferences,true));
$identity = $this->preferences->getIdentity((int)$this->sessionData['identity'],true);
$signature = $this->bosignatures->getSignature((int)$this->sessionData['signatureID']);
$identity = array();//$this->preferences->getIdentity((int)$this->sessionData['identity'],true);
$signature = array();//$this->bosignatures->getSignature((int)$this->sessionData['signatureID']);
//error_log($this->sessionData['identity']);
//error_log(print_r($identity,true));
// create the messages
@ -2196,8 +2196,8 @@ class mail_compose
#print "<pre>". $mail->getMessageBody() ."</pre><hr><br>";
#exit;
$ogServer = $this->preferences->getOutgoingServer($this->mail_bo->profileID);
#_debug_array($ogServer);
$ogServer = $this->mail_bo->ogServer;
//_debug_array($ogServer);
$mail->Host = $ogServer->host;
$mail->Port = $ogServer->port;
// SMTP Auth??