Skip to content
Snippets Groups Projects
Commit 2a44e953 authored by Jared Hancock's avatar Jared Hancock
Browse files

Handle parsing email if Reply-To header is missing

parent bd0169ba
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment