forked from extern/egroupware
* Mail: import and display of mails failed, if personal part of addresses contains valid encoded utf-8 characters
- using now Horde_Mime_Headers::parseHeaders() for headers instead of Mail_mimeDecode, which should be completly replaced with Horde_Mime_Part::parseMessage() - replaced imap_rfc822_parse_adrlist with Horde_Mail_Rfc822::parseAddressList() using static wrapper emailadmin_imapbase::parseAddressList() r49066: sending mail was failing after r49065
This commit is contained in:
parent
570558ff31
commit
9a2cfa0782
@ -2040,15 +2040,15 @@ class emailadmin_imapbase
|
|||||||
|
|
||||||
if ($_tryIDNConversion===true && stripos($_string,'@')!==false)
|
if ($_tryIDNConversion===true && stripos($_string,'@')!==false)
|
||||||
{
|
{
|
||||||
$rfcAddr = imap_rfc822_parse_adrlist($_string,'');
|
$rfcAddr = self::parseAddressList($_string);
|
||||||
if (!isset(self::$idna2)) self::$idna2 = new egw_idna;
|
if (!isset(self::$idna2)) self::$idna2 = new egw_idna;
|
||||||
if (isset(self::$idna2))
|
if (isset(self::$idna2))
|
||||||
{
|
{
|
||||||
$stringA = array();
|
$stringA = array();
|
||||||
//$_string = str_replace($rfcAddr[0]->host,self::$idna2->decode($rfcAddr[0]->host),$_string);
|
//$_string = str_replace($rfcAddr[0]->host,self::$idna2->decode($rfcAddr[0]->host),$_string);
|
||||||
foreach ((array)$rfcAddr as $_rfcAddr)
|
foreach ($rfcAddr as $_rfcAddr)
|
||||||
{
|
{
|
||||||
if ($_rfcAddr->host=='.SYNTAX-ERROR.')
|
if (!$_rfcAddr->valid)
|
||||||
{
|
{
|
||||||
$stringA = array();
|
$stringA = array();
|
||||||
break; // skip idna conversion if we encounter an error here
|
break; // skip idna conversion if we encounter an error here
|
||||||
@ -4495,8 +4495,7 @@ class emailadmin_imapbase
|
|||||||
foreach($recepientList as $recepientType) {
|
foreach($recepientList as $recepientType) {
|
||||||
if(isset($headers[$recepientType])) {
|
if(isset($headers[$recepientType])) {
|
||||||
if ($decode) $headers[$recepientType] = self::decode_header($headers[$recepientType],true);
|
if ($decode) $headers[$recepientType] = self::decode_header($headers[$recepientType],true);
|
||||||
$addresses = imap_rfc822_parse_adrlist($headers[$recepientType], '');
|
foreach(self::parseAddressList($headers[$recepientType]) as $singleAddress) {
|
||||||
foreach($addresses as $singleAddress) {
|
|
||||||
$addressData = array(
|
$addressData = array(
|
||||||
'PERSONAL_NAME' => $singleAddress->personal ? $singleAddress->personal : 'NIL',
|
'PERSONAL_NAME' => $singleAddress->personal ? $singleAddress->personal : 'NIL',
|
||||||
'AT_DOMAIN_LIST' => $singleAddress->adl ? $singleAddress->adl : 'NIL',
|
'AT_DOMAIN_LIST' => $singleAddress->adl ? $singleAddress->adl : 'NIL',
|
||||||
@ -5458,16 +5457,16 @@ class emailadmin_imapbase
|
|||||||
}
|
}
|
||||||
if ($addressData['RFC822_EMAIL'])
|
if ($addressData['RFC822_EMAIL'])
|
||||||
{
|
{
|
||||||
$addressObjectA = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($addressData['RFC822_EMAIL']):$addressData['RFC822_EMAIL']),'');
|
$addressObjectA = self::parseAddressList($addressData['RFC822_EMAIL']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$emailaddress = ($addressData['PERSONAL_NAME']?$addressData['PERSONAL_NAME'].' <'.$addressData['EMAIL'].'>':$addressData['EMAIL']);
|
$emailaddress = ($addressData['PERSONAL_NAME']?$addressData['PERSONAL_NAME'].' <'.$addressData['EMAIL'].'>':$addressData['EMAIL']);
|
||||||
$addressObjectA = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($emailaddress):$emailaddress),'');
|
$addressObjectA = self::parseAddressList($emailaddress);
|
||||||
}
|
}
|
||||||
$addressObject = $addressObjectA[0];
|
$addressObject = $addressObjectA[0];
|
||||||
//error_log(__METHOD__.' ('.__LINE__.') '.array2string($addressObject));
|
//error_log(__METHOD__.' ('.__LINE__.') '.array2string($addressObject));
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
if (!$addressObject->valid) continue;
|
||||||
//$mb =(string)$addressObject->mailbox;
|
//$mb =(string)$addressObject->mailbox;
|
||||||
//$h = (string)$addressObject->host;
|
//$h = (string)$addressObject->host;
|
||||||
//$p = (string)$addressObject->personal;
|
//$p = (string)$addressObject->personal;
|
||||||
@ -6077,15 +6076,16 @@ class emailadmin_imapbase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parseRawMessageIntoMailObject - parses a message/rfc mail from file to the mailobject and returns the header and body via reference
|
* Parses a message/rfc mail from file to the mailobject and returns the header and body via reference
|
||||||
* throws egw_exception_assertion_failed when the required Pear Class is not found/loadable
|
*
|
||||||
* @param object $mailObject instance of the SMTP Mailer Object
|
* @param PHPMailer $mailObject instance of the SMTP Mailer Object
|
||||||
* @param mixed string/object $message string containing the RawMessage / object Mail_mimeDecoded message (part))
|
* @param string|Horde_Mime_Part $message string containing the RawMessage / object Mail_mimeDecoded message (part))
|
||||||
* @param string &$Header reference used to return the imported Mailheader
|
* @param string &$Header reference used to return the imported Mailheader
|
||||||
* @param string &$Body reference to return the imported Body
|
* @param string &$Body reference to return the imported Body
|
||||||
|
* @throws egw_exception_assertion_failed when the required Horde_Mail_Part not found
|
||||||
* @return void Mailheader and body is returned via Reference in $Header $Body
|
* @return void Mailheader and body is returned via Reference in $Header $Body
|
||||||
*/
|
*/
|
||||||
function parseRawMessageIntoMailObject($mailObject,$message,&$Header,&$Body)
|
function parseRawMessageIntoMailObject(PHPMailer $mailObject, $message, &$Header, &$Body)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* pear/Mail_mimeDecode requires package "pear/Mail_Mime" (version >= 1.4.0, excluded versions: 1.4.0)
|
* pear/Mail_mimeDecode requires package "pear/Mail_Mime" (version >= 1.4.0, excluded versions: 1.4.0)
|
||||||
@ -6100,7 +6100,7 @@ class emailadmin_imapbase
|
|||||||
$mailDecode = new Mail_mimeDecode($message);
|
$mailDecode = new Mail_mimeDecode($message);
|
||||||
$structure = $mailDecode->decode(array('include_bodies'=>true,'decode_bodies'=>true,'decode_headers'=>true));
|
$structure = $mailDecode->decode(array('include_bodies'=>true,'decode_bodies'=>true,'decode_headers'=>true));
|
||||||
}
|
}
|
||||||
if (is_object($message))
|
elseif (is_object($message))
|
||||||
{
|
{
|
||||||
$structure = $message;
|
$structure = $message;
|
||||||
}
|
}
|
||||||
@ -6113,17 +6113,16 @@ class emailadmin_imapbase
|
|||||||
$mailObject->CharSet = self::$displayCharset; // some default, may be altered by BodyImport
|
$mailObject->CharSet = self::$displayCharset; // some default, may be altered by BodyImport
|
||||||
if (isset($structure->ctype_parameters['charset'])) $mailObject->CharSet = trim($structure->ctype_parameters['charset']);
|
if (isset($structure->ctype_parameters['charset'])) $mailObject->CharSet = trim($structure->ctype_parameters['charset']);
|
||||||
$mailObject->Encoding = 'quoted-printable'; // some default, may be altered by BodyImport
|
$mailObject->Encoding = 'quoted-printable'; // some default, may be altered by BodyImport
|
||||||
/*
|
|
||||||
$mailObject->AddAddress($emailAddress, $addressObject->personal);
|
|
||||||
$mailObject->AddCC($emailAddress, $addressObject->personal);
|
|
||||||
$mailObject->AddBCC($emailAddress, $addressObject->personal);
|
|
||||||
$mailObject->AddReplyto($emailAddress, $addressObject->personal);
|
|
||||||
*/
|
|
||||||
$result ='';
|
|
||||||
$contenttypecalendar = '';
|
$contenttypecalendar = '';
|
||||||
$myReplyTo = '';
|
$myReplyTo = '';
|
||||||
foreach((array)$structure->headers as $key => $val)
|
|
||||||
|
// use Horde code to parse header, Mail_mimeDecode fails with utf-8
|
||||||
|
$headers = Horde_Mime_Headers::parseHeaders(substr($message, 0, strpos($message, Horde_Mime_Part::RFC_EOL.Horde_Mime_Part::RFC_EOL)));
|
||||||
|
|
||||||
|
foreach($headers->toArray(array('charset' => self::$displayCharset)) as $key => $val)
|
||||||
{
|
{
|
||||||
|
$key = strtolower($key);
|
||||||
//error_log(__METHOD__.' ('.__LINE__.') '.$key.'->'.$val);
|
//error_log(__METHOD__.' ('.__LINE__.') '.$key.'->'.$val);
|
||||||
foreach((array)$val as $i => $v)
|
foreach((array)$val as $i => $v)
|
||||||
{
|
{
|
||||||
@ -6156,9 +6155,9 @@ class emailadmin_imapbase
|
|||||||
case 'bcc':
|
case 'bcc':
|
||||||
case 'from':
|
case 'from':
|
||||||
case 'reply-to':
|
case 'reply-to':
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($val):$val),'');
|
$address_array = self::parseAddressList($val);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach((array)$address_array as $addressObject)
|
foreach($address_array as $addressObject)
|
||||||
{
|
{
|
||||||
$mb = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
$mb = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||||
$pName = $addressObject->personal;
|
$pName = $addressObject->personal;
|
||||||
@ -6251,6 +6250,23 @@ error_log(__METHOD__.__LINE__.$mailObject->EncodeHeader($mailObject->SecureHeade
|
|||||||
//exit;
|
//exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse an address-list
|
||||||
|
*
|
||||||
|
* Replaces imap_rfc822_parse_adrlist, which fails for utf-8, if not our replacement in common_functions is used!
|
||||||
|
*
|
||||||
|
* @param string $addresses
|
||||||
|
* @param string $default_domain
|
||||||
|
* @return Horde_Mail_Rfc822_List iteratable Horde_Mail_Rfc822_Address objects with attributes mailbox, host, personal and valid
|
||||||
|
*/
|
||||||
|
public static function parseAddressList($addresses, $default_domain=null)
|
||||||
|
{
|
||||||
|
$rfc822 = new Horde_Mail_Rfc822();
|
||||||
|
$ret = $rfc822->parseAddressList($addresses, $default_domain ? array('default_domain' => $default_domain) : array());
|
||||||
|
//foreach($ret as $i => $adr) error_log(__METHOD__."('$addresses', $default_domain) parsed $i: mailbox=$adr->mailbox, host=$adr->host, personal=$adr->personal --> ".$adr);
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createBodyFromStructure - fetches/creates the bodypart of the email as textual representation
|
* createBodyFromStructure - fetches/creates the bodypart of the email as textual representation
|
||||||
* is called recursively to be able to fetch the stuctureparts of the mail parsed from Mail/mimeDecode
|
* is called recursively to be able to fetch the stuctureparts of the mail parsed from Mail/mimeDecode
|
||||||
@ -6486,7 +6502,7 @@ error_log(__METHOD__.__LINE__.$mailObject->EncodeHeader($mailObject->SecureHeade
|
|||||||
} else if ( isset($headers['X-CONFIRM-READING-TO']) ) {
|
} else if ( isset($headers['X-CONFIRM-READING-TO']) ) {
|
||||||
$toAddr = $headers['X-CONFIRM-READING-TO'];
|
$toAddr = $headers['X-CONFIRM-READING-TO'];
|
||||||
} else return false;
|
} else return false;
|
||||||
$singleAddress = imap_rfc822_parse_adrlist($toAddr,'');
|
$singleAddress = self::parseAddressList($toAddr);
|
||||||
if (self::$debug) error_log(__METHOD__.__LINE__.' To Address:'.$singleAddress[0]->mailbox."@".$singleAddress[0]->host.", ".$singleAddress[0]->personal);
|
if (self::$debug) error_log(__METHOD__.__LINE__.' To Address:'.$singleAddress[0]->mailbox."@".$singleAddress[0]->host.", ".$singleAddress[0]->personal);
|
||||||
$send->AddAddress($singleAddress[0]->mailbox."@".$singleAddress[0]->host, $singleAddress[0]->personal);
|
$send->AddAddress($singleAddress[0]->mailbox."@".$singleAddress[0]->host, $singleAddress[0]->personal);
|
||||||
$send->AddCustomHeader('References: '.$headers['MESSAGE-ID']);
|
$send->AddCustomHeader('References: '.$headers['MESSAGE-ID']);
|
||||||
|
@ -471,9 +471,8 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
|||||||
$mailObject->MessageID = $message->headers['message-id'];
|
$mailObject->MessageID = $message->headers['message-id'];
|
||||||
/* the client send garbage sometimes (blackberry->domain\username)
|
/* the client send garbage sometimes (blackberry->domain\username)
|
||||||
// from
|
// from
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($message->headers['from']):$message->headers['from']),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($message->headers['from']):$message->headers['from'])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
if (!$addressObject->valid) continue;
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
|
||||||
if ($this->debugLevel>0) debugLog("Header Sentmail From: ".array2string($addressObject).' vs. '.array2string($message->headers['from']));
|
if ($this->debugLevel>0) debugLog("Header Sentmail From: ".array2string($addressObject).' vs. '.array2string($message->headers['from']));
|
||||||
$mailObject->From = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
$mailObject->From = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||||
$mailObject->FromName = $addressObject->personal;
|
$mailObject->FromName = $addressObject->personal;
|
||||||
@ -481,39 +480,34 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
|||||||
*/
|
*/
|
||||||
// prepare addressee list; moved the adding of addresses to the mailobject down
|
// prepare addressee list; moved the adding of addresses to the mailobject down
|
||||||
// to
|
// to
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($message->headers["to"]):$message->headers["to"]),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($message->headers["to"]):$message->headers["to"])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
if (!$addressObject->valid) continue;
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
|
||||||
if ($this->debugLevel>0) debugLog("Header Sentmail To: ".array2string($addressObject) );
|
if ($this->debugLevel>0) debugLog("Header Sentmail To: ".array2string($addressObject) );
|
||||||
//$mailObject->AddAddress($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
//$mailObject->AddAddress($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
||||||
$toMailAddr[] = imap_rfc822_write_address($addressObject->mailbox, $addressObject->host, $addressObject->personal);
|
$toMailAddr[] = imap_rfc822_write_address($addressObject->mailbox, $addressObject->host, $addressObject->personal);
|
||||||
}
|
}
|
||||||
// CC
|
// CC
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($message->headers["cc"]):$message->headers["cc"]),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($message->headers["cc"]):$message->headers["cc"])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
if (!$addressObject->valid) continue;
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
|
||||||
if ($this->debugLevel>0) debugLog("Header Sentmail CC: ".array2string($addressObject) );
|
if ($this->debugLevel>0) debugLog("Header Sentmail CC: ".array2string($addressObject) );
|
||||||
//$mailObject->AddCC($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
//$mailObject->AddCC($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
||||||
$ccMailAddr[] = imap_rfc822_write_address($addressObject->mailbox, $addressObject->host, $addressObject->personal);
|
$ccMailAddr[] = imap_rfc822_write_address($addressObject->mailbox, $addressObject->host, $addressObject->personal);
|
||||||
}
|
}
|
||||||
// BCC
|
// BCC
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($message->headers["bcc"]):$message->headers["bcc"]),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($message->headers["bcc"]):$message->headers["bcc"])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
if (!$addressObject->valid) continue;
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
|
||||||
if ($this->debugLevel>0) debugLog("Header Sentmail BCC: ".array2string($addressObject) );
|
if ($this->debugLevel>0) debugLog("Header Sentmail BCC: ".array2string($addressObject) );
|
||||||
//$mailObject->AddBCC($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
//$mailObject->AddBCC($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
||||||
$bccMailAddr[] = imap_rfc822_write_address($addressObject->mailbox, $addressObject->host, $addressObject->personal);
|
$bccMailAddr[] = imap_rfc822_write_address($addressObject->mailbox, $addressObject->host, $addressObject->personal);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// AddReplyTo
|
// AddReplyTo
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($message->headers['reply-to']):$message->headers['reply-to']),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($message->headers['reply-to']):$message->headers['reply-to'])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
if (!$addressObject->valid) continue;
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
|
||||||
if ($this->debugLevel>0) debugLog("Header Sentmail REPLY-TO: ".array2string($addressObject) );
|
if ($this->debugLevel>0) debugLog("Header Sentmail REPLY-TO: ".array2string($addressObject) );
|
||||||
$mailObject->AddReplyTo($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
$mailObject->AddReplyTo($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$addedfullname = false;
|
|
||||||
// save some headers when forwarding mails (content type & transfer-encoding)
|
// save some headers when forwarding mails (content type & transfer-encoding)
|
||||||
$headers = "";
|
$headers = "";
|
||||||
|
|
||||||
@ -605,8 +599,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
|||||||
$toCount = 0;
|
$toCount = 0;
|
||||||
//error_log(__METHOD__.__LINE__.array2string($toMailAddr));
|
//error_log(__METHOD__.__LINE__.array2string($toMailAddr));
|
||||||
foreach((array)$toMailAddr as $address) {
|
foreach((array)$toMailAddr as $address) {
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($address):$address)) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||||
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' && calendar_boupdate::email_update_requested($emailAddress,(isset($cSMRMethod)?$cSMRMethod:'REQUEST'))) continue;
|
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' && calendar_boupdate::email_update_requested($emailAddress,(isset($cSMRMethod)?$cSMRMethod:'REQUEST'))) continue;
|
||||||
$mailObject->AddAddress($emailAddress, $addressObject->personal);
|
$mailObject->AddAddress($emailAddress, $addressObject->personal);
|
||||||
@ -615,8 +608,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
|||||||
}
|
}
|
||||||
$ccCount = 0;
|
$ccCount = 0;
|
||||||
foreach((array)$ccMailAddr as $address) {
|
foreach((array)$ccMailAddr as $address) {
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($address):$address)) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||||
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' && calendar_boupdate::email_update_requested($emailAddress)) continue;
|
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' && calendar_boupdate::email_update_requested($emailAddress)) continue;
|
||||||
$mailObject->AddCC($emailAddress, $addressObject->personal);
|
$mailObject->AddCC($emailAddress, $addressObject->personal);
|
||||||
@ -625,8 +617,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
|||||||
}
|
}
|
||||||
$bccCount = 0;
|
$bccCount = 0;
|
||||||
foreach((array)$bccMailAddr as $address) {
|
foreach((array)$bccMailAddr as $address) {
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($address):$address)) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||||
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' && calendar_boupdate::email_update_requested($emailAddress)) continue;
|
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' && calendar_boupdate::email_update_requested($emailAddress)) continue;
|
||||||
$mailObject->AddBCC($emailAddress, $addressObject->personal);
|
$mailObject->AddBCC($emailAddress, $addressObject->personal);
|
||||||
@ -928,8 +919,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
|||||||
}
|
}
|
||||||
if (count($folderArray) > 0) {
|
if (count($folderArray) > 0) {
|
||||||
foreach((array)$bccMailAddr as $address) {
|
foreach((array)$bccMailAddr as $address) {
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($address):$address)) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||||
$mailAddr[] = array($emailAddress, $addressObject->personal);
|
$mailAddr[] = array($emailAddress, $addressObject->personal);
|
||||||
}
|
}
|
||||||
@ -1122,33 +1112,29 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
|||||||
$mailObject->Subject = $headers['SUBJECT'];
|
$mailObject->Subject = $headers['SUBJECT'];
|
||||||
$mailObject->MessageID = $headers['MESSAGE-ID'];
|
$mailObject->MessageID = $headers['MESSAGE-ID'];
|
||||||
// from
|
// from
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($headers['FROM']):$headers['FROM']),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($headers['FROM']):$headers['FROM'])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
//debugLog(__METHOD__.__LINE__.'Address to add (FROM):'.array2string($addressObject));
|
//debugLog(__METHOD__.__LINE__.'Address to add (FROM):'.array2string($addressObject));
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
if (!$addressObject->valid) continue;
|
||||||
$mailObject->From = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
$mailObject->From = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
||||||
$mailObject->FromName = $addressObject->personal;
|
$mailObject->FromName = $addressObject->personal;
|
||||||
//error_log(__METHOD__.__LINE__.'Address to add (FROM):'.array2string($addressObject));
|
//error_log(__METHOD__.__LINE__.'Address to add (FROM):'.array2string($addressObject));
|
||||||
}
|
}
|
||||||
// to
|
// to
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($headers['TO']):$headers['TO']),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($headers['TO']):$headers['TO'])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
//debugLog(__METHOD__.__LINE__.'Address to add (TO):'.array2string($addressObject));
|
//debugLog(__METHOD__.__LINE__.'Address to add (TO):'.array2string($addressObject));
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
if (!$addressObject->valid) continue;
|
||||||
$mailObject->AddAddress($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
$mailObject->AddAddress($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
||||||
}
|
}
|
||||||
// CC
|
// CC
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($headers['CC']):$headers['CC']),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($headers['CC']):$headers['CC'])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
//debugLog(__METHOD__.__LINE__.'Address to add (CC):'.array2string($addressObject));
|
//debugLog(__METHOD__.__LINE__.'Address to add (CC):'.array2string($addressObject));
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
if (!$addressObject->valid) continue;
|
||||||
$mailObject->AddCC($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
$mailObject->AddCC($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
||||||
}
|
}
|
||||||
// AddReplyTo
|
// AddReplyTo
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($headers['REPLY-TO']):$headers['REPLY-TO']),'');
|
foreach(emailadmin_imapbase::parseAddressList((get_magic_quotes_gpc()?stripslashes($headers['REPLY-TO']):$headers['REPLY-TO'])) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
//debugLog(__METHOD__.__LINE__.'Address to add (ReplyTO):'.array2string($addressObject));
|
//debugLog(__METHOD__.__LINE__.'Address to add (ReplyTO):'.array2string($addressObject));
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
if (!$addressObject->valid) continue;
|
||||||
$mailObject->AddReplyTo($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
$mailObject->AddReplyTo($addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''),$addressObject->personal);
|
||||||
}
|
}
|
||||||
$Header = $Body = ''; // we do not use Header and Body we use the MailObject
|
$Header = $Body = ''; // we do not use Header and Body we use the MailObject
|
||||||
|
@ -1140,9 +1140,7 @@ class mail_compose
|
|||||||
//error_log(__METHOD__.__LINE__.array2string(array('key'=>$key,'value'=>$value)));
|
//error_log(__METHOD__.__LINE__.array2string(array('key'=>$key,'value'=>$value)));
|
||||||
$value = htmlspecialchars_decode($value,ENT_COMPAT);
|
$value = htmlspecialchars_decode($value,ENT_COMPAT);
|
||||||
$value = str_replace("\"\"",'"',$value);
|
$value = str_replace("\"\"",'"',$value);
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($value):$value), '');
|
foreach(emailadmin_imapbase::parseAddressList($value) as $addressObject) {
|
||||||
//unset($content[strtolower($destination)]);
|
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
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);
|
||||||
@ -1416,9 +1414,9 @@ class mail_compose
|
|||||||
|
|
||||||
function generateRFC822Address($_addressObject)
|
function generateRFC822Address($_addressObject)
|
||||||
{
|
{
|
||||||
if(!empty($_addressObject->personal) && !empty($_addressObject->mailbox) && !empty($_addressObject->host)) {
|
if($_addressObject->personal && $_addressObject->mailbox && $_addressObject->host) {
|
||||||
return sprintf('"%s" <%s@%s>', $this->mail_bo->decode_header($_addressObject->personal), $_addressObject->mailbox, $this->mail_bo->decode_header($_addressObject->host,'FORCE'));
|
return sprintf('"%s" <%s@%s>', $this->mail_bo->decode_header($_addressObject->personal), $_addressObject->mailbox, $this->mail_bo->decode_header($_addressObject->host,'FORCE'));
|
||||||
} elseif(!empty($_addressObject->mailbox) && !empty($_addressObject->host)) {
|
} elseif($_addressObject->mailbox && $_addressObject->host) {
|
||||||
return sprintf("%s@%s", $_addressObject->mailbox, $this->mail_bo->decode_header($_addressObject->host,'FORCE'));
|
return sprintf("%s@%s", $_addressObject->mailbox, $this->mail_bo->decode_header($_addressObject->host,'FORCE'));
|
||||||
} else {
|
} else {
|
||||||
return $this->mail_bo->decode_header($_addressObject->mailbox,true);
|
return $this->mail_bo->decode_header($_addressObject->mailbox,true);
|
||||||
@ -1491,10 +1489,10 @@ class mail_compose
|
|||||||
$this->sessionData['messageFolder'] = $_folder;
|
$this->sessionData['messageFolder'] = $_folder;
|
||||||
$this->sessionData['isDraft'] = true;
|
$this->sessionData['isDraft'] = true;
|
||||||
foreach((array)$headers['CC'] as $val) {
|
foreach((array)$headers['CC'] as $val) {
|
||||||
$rfcAddr=imap_rfc822_parse_adrlist($val, '');
|
$rfcAddr=emailadmin_imapbase::parseAddressList($val);
|
||||||
$_rfcAddr = $rfcAddr[0];
|
$_rfcAddr = $rfcAddr[0];
|
||||||
if ($_rfcAddr->host=='.SYNTAX-ERROR.') continue;
|
if (!$_rfcAddr->valid) continue;
|
||||||
if($_rfcAddr->mailbox == 'undisclosed-recipients' || (empty($_rfcAddr->mailbox) && empty($_rfcAddr->host)) ) {
|
if($_rfcAddr->mailbox == 'undisclosed-recipients' || (!$_rfcAddr->mailbox && !$_rfcAddr->host) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$keyemail=$_rfcAddr->mailbox.'@'.$_rfcAddr->host;
|
$keyemail=$_rfcAddr->mailbox.'@'.$_rfcAddr->host;
|
||||||
@ -1512,10 +1510,10 @@ class mail_compose
|
|||||||
$this->sessionData['to'][] = $val;
|
$this->sessionData['to'][] = $val;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$rfcAddr=imap_rfc822_parse_adrlist($val, '');
|
$rfcAddr=emailadmin_imapbase::parseAddressList($val);
|
||||||
$_rfcAddr = $rfcAddr[0];
|
$_rfcAddr = $rfcAddr[0];
|
||||||
if ($_rfcAddr->host=='.SYNTAX-ERROR.') continue;
|
if (!$_rfcAddr->valid) continue;
|
||||||
if($_rfcAddr->mailbox == 'undisclosed-recipients' || (empty($_rfcAddr->mailbox) && empty($_rfcAddr->host)) ) {
|
if($_rfcAddr->mailbox == 'undisclosed-recipients' || (!$_rfcAddr->mailbox && !$_rfcAddr->host) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$keyemail=$_rfcAddr->mailbox.'@'.$_rfcAddr->host;
|
$keyemail=$_rfcAddr->mailbox.'@'.$_rfcAddr->host;
|
||||||
@ -1528,9 +1526,9 @@ class mail_compose
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach((array)$headers['REPLY-TO'] as $val) {
|
foreach((array)$headers['REPLY-TO'] as $val) {
|
||||||
$rfcAddr=imap_rfc822_parse_adrlist($val, '');
|
$rfcAddr=emailadmin_imapbase::parseAddressList($val);
|
||||||
$_rfcAddr = $rfcAddr[0];
|
$_rfcAddr = $rfcAddr[0];
|
||||||
if ($_rfcAddr->host=='.SYNTAX-ERROR.') continue;
|
if (!$_rfcAddr->valid) continue;
|
||||||
if($_rfcAddr->mailbox == 'undisclosed-recipients' || (empty($_rfcAddr->mailbox) && empty($_rfcAddr->host)) ) {
|
if($_rfcAddr->mailbox == 'undisclosed-recipients' || (empty($_rfcAddr->mailbox) && empty($_rfcAddr->host)) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1544,9 +1542,9 @@ class mail_compose
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach((array)$headers['BCC'] as $val) {
|
foreach((array)$headers['BCC'] as $val) {
|
||||||
$rfcAddr=imap_rfc822_parse_adrlist($val, '');
|
$rfcAddr=emailadmin_imapbase::parseAddressList($val);
|
||||||
$_rfcAddr = $rfcAddr[0];
|
$_rfcAddr = $rfcAddr[0];
|
||||||
if ($_rfcAddr->host=='.SYNTAX-ERROR.') continue;
|
if (!$_rfcAddr->valid) continue;
|
||||||
if($_rfcAddr->mailbox == 'undisclosed-recipients' || (empty($_rfcAddr->mailbox) && empty($_rfcAddr->host)) ) {
|
if($_rfcAddr->mailbox == 'undisclosed-recipients' || (empty($_rfcAddr->mailbox) && empty($_rfcAddr->host)) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2153,57 +2151,23 @@ class mail_compose
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Expand any mailing lists
|
// Expand any mailing lists
|
||||||
foreach(array('to','cc','bcc') as $field)
|
foreach(array(
|
||||||
|
'to' => 'AddAddress',
|
||||||
|
'cc' => 'AddCC',
|
||||||
|
'bcc' => 'AddBCC',
|
||||||
|
'replyto' => 'AddReplyto') as $field => $method)
|
||||||
{
|
{
|
||||||
$_formData[$field] = self::resolveEmailAddressList($_formData[$field]);
|
if ($field != 'replyto') $_formData[$field] = self::resolveEmailAddressList($_formData[$field]);
|
||||||
}
|
|
||||||
|
|
||||||
foreach((array)$_formData['to'] as $address) {
|
foreach((array)$_formData[$field] as $address)
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address), '');
|
{
|
||||||
foreach((array)$address_array as $addressObject) {
|
foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) {
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
if (!$addressObject->valid) continue;
|
||||||
$_emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
$_emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$mail_bo->idna2->encode($addressObject->host) : '');
|
$emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$mail_bo->idna2->encode($addressObject->host) : '');
|
||||||
#$emailName = $mail_bo->encodeHeader($addressObject->personal, 'q');
|
$_mailObject->$method($emailAddress, str_replace(array('@'),' ',($addressObject->personal?$addressObject->personal:$_emailAddress)));
|
||||||
#$_mailObject->AddAddress($emailAddress, $emailName);
|
|
||||||
$_mailObject->AddAddress($emailAddress, str_replace(array('@'),' ',($addressObject->personal?$addressObject->personal:$_emailAddress)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach((array)$_formData['cc'] as $address) {
|
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
|
||||||
$_emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$mail_bo->idna2->encode($addressObject->host) : '');
|
|
||||||
#$emailName = $mail_bo->encodeHeader($addressObject->personal, 'q');
|
|
||||||
#$_mailObject->AddCC($emailAddress, $emailName);
|
|
||||||
$_mailObject->AddCC($emailAddress, str_replace(array('@'),' ',($addressObject->personal?$addressObject->personal:$_emailAddress)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach((array)$_formData['bcc'] as $address) {
|
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
|
||||||
$_emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$mail_bo->idna2->encode($addressObject->host) : '');
|
|
||||||
#$emailName = $mail_bo->encodeHeader($addressObject->personal, 'q');
|
|
||||||
#$_mailObject->AddBCC($emailAddress, $emailName);
|
|
||||||
$_mailObject->AddBCC($emailAddress, str_replace(array('@'),' ',($addressObject->personal?$addressObject->personal:$_emailAddress)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach((array)$_formData['replyto'] as $address) {
|
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
|
||||||
foreach((array)$address_array as $addressObject) {
|
|
||||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
|
||||||
$_emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
|
||||||
#$emailName = $mail_bo->encodeHeader($addressObject->personal, 'q');
|
|
||||||
#$_mailObject->AddBCC($emailAddress, $emailName);
|
|
||||||
$_mailObject->AddReplyto($emailAddress, str_replace(array('@'),' ',($addressObject->personal?$addressObject->personal:$_emailAddress)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//$_mailObject->WordWrap = 76; // as we break lines ourself, we will not need/use the buildin WordWrap
|
//$_mailObject->WordWrap = 76; // as we break lines ourself, we will not need/use the buildin WordWrap
|
||||||
@ -2491,9 +2455,8 @@ class mail_compose
|
|||||||
$this->createMessage($mail, $_formData, $identity);
|
$this->createMessage($mail, $_formData, $identity);
|
||||||
$this->sessionData['bcc'] = self::resolveEmailAddressList($this->sessionData['bcc']);
|
$this->sessionData['bcc'] = self::resolveEmailAddressList($this->sessionData['bcc']);
|
||||||
foreach((array)$this->sessionData['bcc'] as $address) {
|
foreach((array)$this->sessionData['bcc'] as $address) {
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
$emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
|
||||||
$mailAddr[] = array($emailAddress, $addressObject->personal);
|
$mailAddr[] = array($emailAddress, $addressObject->personal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2768,9 +2731,8 @@ class mail_compose
|
|||||||
if (count($folder) > 0 || $_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on') {
|
if (count($folder) > 0 || $_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on') {
|
||||||
//error_log(__METHOD__.__LINE__.array2string($this->sessionData['bcc']));
|
//error_log(__METHOD__.__LINE__.array2string($this->sessionData['bcc']));
|
||||||
foreach((array)$this->sessionData['bcc'] as $address) {
|
foreach((array)$this->sessionData['bcc'] as $address) {
|
||||||
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($address):$address),'');
|
foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) {
|
||||||
foreach((array)$address_array as $addressObject) {
|
$emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
|
||||||
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : '');
|
|
||||||
$mailAddr[] = array($emailAddress, $addressObject->personal);
|
$mailAddr[] = array($emailAddress, $addressObject->personal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user