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 { ...@@ -132,16 +132,26 @@ class Mail_Parse {
function getFromAddressList(){ 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(){ function getToAddressList(){
//Delivered-to incase it was a BBC mail. // 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']); if (!($header = $this->struct->headers['to']))
if (!($header = $this->struct->headers['delivered-to']))
return null;
return Mail_Parse::parseAddressList($header);
} }
function getCcAddressList(){ 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(){ function getMessageId(){
...@@ -153,7 +163,10 @@ class Mail_Parse { ...@@ -153,7 +163,10 @@ class Mail_Parse {
} }
function getReplyTo() { 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(){ function getBody(){
...@@ -371,7 +384,7 @@ class EmailDataParser { ...@@ -371,7 +384,7 @@ class EmailDataParser {
$data['in-reply-to'] = $parser->struct->headers['in-reply-to']; $data['in-reply-to'] = $parser->struct->headers['in-reply-to'];
$data['references'] = $parser->struct->headers['references']; $data['references'] = $parser->struct->headers['references'];
if ($replyto = $parser->getReplyTo()) { if (($replyto = $parser->getReplyTo()) && !PEAR::isError($replyto)) {
$replyto = $replyto[0]; $replyto = $replyto[0];
$data['reply-to'] = $replyto->mailbox.'@'.$replyto->host; $data['reply-to'] = $replyto->mailbox.'@'.$replyto->host;
if ($replyto->personal) if ($replyto->personal)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment