sending mail was failing after r49065

This commit is contained in:
Ralf Becker 2014-10-20 06:49:23 +00:00
parent 64aa838e9d
commit 8a827671b8

View File

@ -1414,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);
@ -1492,7 +1492,7 @@ class mail_compose
$rfcAddr=emailadmin_imapbase::parseAddressList($val); $rfcAddr=emailadmin_imapbase::parseAddressList($val);
$_rfcAddr = $rfcAddr[0]; $_rfcAddr = $rfcAddr[0];
if (!$_rfcAddr->valid) 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;
@ -1513,7 +1513,7 @@ class mail_compose
$rfcAddr=emailadmin_imapbase::parseAddressList($val); $rfcAddr=emailadmin_imapbase::parseAddressList($val);
$_rfcAddr = $rfcAddr[0]; $_rfcAddr = $rfcAddr[0];
if (!$_rfcAddr->valid) 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;
@ -2163,8 +2163,8 @@ class mail_compose
{ {
foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) { foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) {
if (!$addressObject->valid) 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) : '');
$_mailObject->$method($emailAddress, str_replace(array('@'),' ',($addressObject->personal?$addressObject->personal:$_emailAddress))); $_mailObject->$method($emailAddress, str_replace(array('@'),' ',($addressObject->personal?$addressObject->personal:$_emailAddress)));
} }
} }
@ -2456,7 +2456,7 @@ class mail_compose
$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) {
foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) { foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) {
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''); $emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
$mailAddr[] = array($emailAddress, $addressObject->personal); $mailAddr[] = array($emailAddress, $addressObject->personal);
} }
} }
@ -2732,7 +2732,7 @@ class mail_compose
//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) {
foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) { foreach(emailadmin_imapbase::parseAddressList($address) as $addressObject) {
$emailAddress = $addressObject->mailbox. (!empty($addressObject->host) ? '@'.$addressObject->host : ''); $emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
$mailAddr[] = array($emailAddress, $addressObject->personal); $mailAddr[] = array($emailAddress, $addressObject->personal);
} }
} }