From 7d38dfaebed3ec3878a9fb36186ee63280caa19f Mon Sep 17 00:00:00 2001 From: pdontthink Date: Wed, 24 Oct 2007 10:37:30 +0000 Subject: [PATCH] Fix outgoing messages to allow addresses such as "0" or "000", etc. See #1818398 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12738 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- class/deliver/Deliver_SMTP.class.php | 8 ++++---- class/mime/Rfc822Header.class.php | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/class/deliver/Deliver_SMTP.class.php b/class/deliver/Deliver_SMTP.class.php index 431ad74c..5ac04372 100644 --- a/class/deliver/Deliver_SMTP.class.php +++ b/class/deliver/Deliver_SMTP.class.php @@ -294,7 +294,7 @@ class Deliver_SMTP extends Deliver { } /* Ok, who is sending the message? */ - $fromaddress = ($from->mailbox && $from->host) ? + $fromaddress = (strlen($from->mailbox) && $from->host) ? $from->mailbox.'@'.$from->host : ''; fputs($stream, 'MAIL FROM:<'.$fromaddress.">\r\n"); $tmp = fgets($stream, 1024); @@ -305,7 +305,7 @@ class Deliver_SMTP extends Deliver { /* send who the recipients are */ for ($i = 0, $cnt = count($to); $i < $cnt; $i++) { if (!$to[$i]->host) $to[$i]->host = $domain; - if ($to[$i]->mailbox) { + if (strlen($to[$i]->mailbox)) { fputs($stream, 'RCPT TO:<'.$to[$i]->mailbox.'@'.$to[$i]->host.">\r\n"); $tmp = fgets($stream, 1024); if ($this->errorCheck($tmp, $stream)) { @@ -316,7 +316,7 @@ class Deliver_SMTP extends Deliver { for ($i = 0, $cnt = count($cc); $i < $cnt; $i++) { if (!$cc[$i]->host) $cc[$i]->host = $domain; - if ($cc[$i]->mailbox) { + if (strlen($cc[$i]->mailbox)) { fputs($stream, 'RCPT TO:<'.$cc[$i]->mailbox.'@'.$cc[$i]->host.">\r\n"); $tmp = fgets($stream, 1024); if ($this->errorCheck($tmp, $stream)) { @@ -327,7 +327,7 @@ class Deliver_SMTP extends Deliver { for ($i = 0, $cnt = count($bcc); $i < $cnt; $i++) { if (!$bcc[$i]->host) $bcc[$i]->host = $domain; - if ($bcc[$i]->mailbox) { + if (strlen($bcc[$i]->mailbox)) { fputs($stream, 'RCPT TO:<'.$bcc[$i]->mailbox.'@'.$bcc[$i]->host.">\r\n"); $tmp = fgets($stream, 1024); if ($this->errorCheck($tmp, $stream)) { diff --git a/class/mime/Rfc822Header.class.php b/class/mime/Rfc822Header.class.php index 2cc08f70..f0eab315 100644 --- a/class/mime/Rfc822Header.class.php +++ b/class/mime/Rfc822Header.class.php @@ -566,7 +566,7 @@ class Rfc822Header { if ($sGroup) { $aAddress[] = $this->createAddressObject($aStack,$aComment,$sEmail,$sGroup); $oAddr = end($aAddress); - if(!$oAddr || ((isset($oAddr)) && !$oAddr->mailbox && !$oAddr->personal)) { + if(!$oAddr || ((isset($oAddr)) && !strlen($oAddr->mailbox) && !$oAddr->personal)) { $sEmail = $sGroup . ':;'; } $aAddress[] = $this->createAddressObject($aStack,$aComment,$sEmail,$sGroup); @@ -617,18 +617,18 @@ class Rfc822Header { } } } - if (!$grouplookup && !$oAddr->mailbox) { + if (!$grouplookup && !strlen($oAddr->mailbox)) { $oAddr->mailbox = trim($sEmail); - if ($sHost && $oAddr->mailbox) { + if ($sHost && strlen($oAddr->mailbox)) { $oAddr->host = $sHost; } } else if (!$grouplookup && !$oAddr->host) { - if ($sHost && $oAddr->mailbox) { + if ($sHost && strlen($oAddr->mailbox)) { $oAddr->host = $sHost; } } } - if (!$aAddrBookAddress && $oAddr->mailbox) { + if (!$aAddrBookAddress && strlen($oAddr->mailbox)) { $aProcessedAddress[] = $oAddr; } else { $aProcessedAddress = array_merge($aProcessedAddress,$aAddrBookAddress); -- 2.25.1