Skip to content
Snippets Groups Projects
Commit 2f97d7e6 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #780 from greezybacon/issue/email-reply-to


Handle parsing email if Reply-To header is missing

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents fb96ed82 2a44e953
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(){
......@@ -372,7 +385,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.
Finish editing this message first!
Please register or to comment