rework of fix for problem regarding send with bcc when using esync

This commit is contained in:
Klaus Leithoff 2016-10-19 10:01:38 +00:00
parent 20f9abafe9
commit d5e8cdca97
2 changed files with 9 additions and 7 deletions

View File

@ -6973,10 +6973,9 @@ class Mail
* @param Mailer $mailer instance of SMTP Mailer object
* @param string|ressource|Horde_Mime_Part $message string or resource containing the RawMessage / object Mail_mimeDecoded message (part))
* @param boolean $force8bitOnPrimaryPart (default false. force transferEncoding and charset to 8bit/utf8 if we have a textpart as primaryPart)
* @param string &$bccAddresses (reference; default empty string; used to transport bcc addresses to the caller)
* @throws Exception\WrongParameter when the required Horde_Mail_Part not found
*/
function parseRawMessageIntoMailObject(Mailer $mailer, $message, $force8bitOnPrimaryPart=false, &$bccAddresses='')
function parseRawMessageIntoMailObject(Mailer $mailer, $message, $force8bitOnPrimaryPart=false)
{
if (is_string($message) || is_resource($message))
{
@ -7011,11 +7010,15 @@ class Mail
//may be altered when retrieving the message e.g. from server
//error_log(__METHOD__.__LINE__.':'.$header.'->'.$val.'<->'.$mailer->getHeader('Content-Transfer-Encoding'));
break;
case 'Bcc':
case 'bcc':
//error_log(__METHOD__.__LINE__.':'.$header.'->'.$val);
$mailer->addBcc($val);
break;
default:
//error_log(__METHOD__.__LINE__.':'.$header.'->'.$val);
if (strtolower($header)=='bcc') $bccAddresses .= $val;
$mailer->addHeader($header, $val, $overwrite);
//error_log(__METHOD__.__LINE__.':'.'getHeader('.$header.')'.array2string($mailer->getHeader($header)).(strtolower($header)=='bcc'?$bccAddresses:''));
//error_log(__METHOD__.__LINE__.':'.'getHeader('.$header.')'.array2string($mailer->getHeader($header)));
}
}
}

View File

@ -420,8 +420,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
if (Api\Translation::detect_encoding($sigTextPlain)!='ascii') $force8bit=true;
// initialize the new Api\Mailer object for sending
$mailObject = new Api\Mailer(self::$profileID);
$bccAddresses='';
$this->mail->parseRawMessageIntoMailObject($mailObject,$smartdata->mime,$force8bit,$bccAddresses);
$this->mail->parseRawMessageIntoMailObject($mailObject,$smartdata->mime,$force8bit);
// Horde SMTP Class uses utf-8 by default. as we set charset always to utf-8
$mailObject->Sender = $activeMailProfile['ident_email'];
$mailObject->setFrom($activeMailProfile['ident_email'],Mail::generateIdentityString($activeMailProfile,false));
@ -443,7 +442,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
$ccMailAddr[] = imap_rfc822_write_address($addressObject->mailbox, $addressObject->host, $addressObject->personal);
}
// BCC
foreach(Mail::parseAddressList(($bccAddresses?$bccAddresses:$mailObject->getHeader("Bcc"))) as $addressObject) {
foreach($mailObject->getAddresses('bcc') as $addressObject) {
if (!$addressObject->valid) continue;
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") Header Sentmail BCC: ".array2string($addressObject) );
//$mailObject->AddBCC($addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : ''),$addressObject->personal);