diff --git a/include/class.mailparse.php b/include/class.mailparse.php index 039a48b74be371ed1def64f502cad0db16c8506e..dbcbf769b1b001020ccc7366445afdbe65922fc5 100644 --- a/include/class.mailparse.php +++ b/include/class.mailparse.php @@ -132,16 +132,26 @@ class Mail_Parse { function getFromAddressList(){ - return Mail_Parse::parseAddressList($this->struct->headers['from']); + if (!($header = $this->struct->headers['from'])) + return null; + + return Mail_Parse::parseAddressList($header); } function getToAddressList(){ - //Delivered-to incase it was a BBC mail. - return Mail_Parse::parseAddressList($this->struct->headers['to']?$this->struct->headers['to']:$this->struct->headers['delivered-to']); + // Delivered-to incase it was a BBC mail. + if (!($header = $this->struct->headers['to'])) + if (!($header = $this->struct->headers['delivered-to'])) + return null; + + return Mail_Parse::parseAddressList($header); } function getCcAddressList(){ - return $this->struct->headers['cc']?Mail_Parse::parseAddressList($this->struct->headers['cc']):null; + if (!($header = $this->struct->headers['cc'])) + return null; + + return Mail_Parse::parseAddressList($header); } function getMessageId(){ @@ -153,7 +163,10 @@ class Mail_Parse { } function getReplyTo() { - return Mail_Parse::parseAddressList($this->struct->headers['reply-to']); + if (!($header = $this->struct->headers['reply-to'])) + return null; + + return Mail_Parse::parseAddressList($header); } function getBody(){ @@ -371,7 +384,7 @@ class EmailDataParser { $data['in-reply-to'] = $parser->struct->headers['in-reply-to']; $data['references'] = $parser->struct->headers['references']; - if ($replyto = $parser->getReplyTo()) { + if (($replyto = $parser->getReplyTo()) && !PEAR::isError($replyto)) { $replyto = $replyto[0]; $data['reply-to'] = $replyto->mailbox.'@'.$replyto->host; if ($replyto->personal)