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

Merge branch 'develop' into develop-next

Conflicts:
	include/class.mailparse.php
parents 48622444 1d75aeb2
No related branches found
No related tags found
No related merge requests found
......@@ -200,10 +200,10 @@ class Email {
function getIdByEmail($email) {
$sql='SELECT email_id FROM '.EMAIL_TABLE.' WHERE email='.db_input($email);
if(($res=db_query($sql)) && db_num_rows($res))
list($id)=db_fetch_row($res);
if(!($res=db_query($sql)) || !db_num_rows($res))
return false;
return $id;
return db_result($res);
}
function lookup($var) {
......
......@@ -95,19 +95,21 @@ class Mail_Parse {
}
// Look for application/tnef attachment and process it
foreach ($this->struct->parts as $i=>$part) {
if (!$part->parts && $part->ctype_primary == 'application'
&& $part->ctype_secondary == 'ms-tnef') {
try {
$tnef = new TnefStreamParser($part->body);
$this->tnef = $tnef->getMessage();
// No longer considered an attachment
unset($this->struct->parts[$i]);
}
catch (TnefException $ex) {
// TNEF will remain an attachment
$this->notes[] = 'TNEF parsing exception: '
.$ex->getMessage();
if ($this->struct && $this->struct->parts) {
foreach ($this->struct->parts as $i=>$part) {
if (!@$part->parts && $part->ctype_primary == 'application'
&& $part->ctype_secondary == 'ms-tnef') {
try {
$tnef = new TnefStreamParser($part->body);
$this->tnef = $tnef->getMessage();
// No longer considered an attachment
unset($this->struct->parts[$i]);
}
catch (TnefException $ex) {
// TNEF will remain an attachment
$this->notes[] = 'TNEF parsing exception: '
.$ex->getMessage();
}
}
}
}
......@@ -496,6 +498,13 @@ class EmailDataParser {
return $this->err('Email parse failed ['.$parser->getError().']');
$data =array();
$data['emailId'] = 0;
$data['recipients'] = array();
$data['subject'] = $parser->getSubject();
$data['header'] = $parser->getHeader();
$data['mid'] = $parser->getMessageId();
$data['priorityId'] = $parser->getPriority();
//FROM address: who sent the email.
if(($fromlist = $parser->getFromAddressList())) {
$from=$fromlist[0]; //Default.
......@@ -522,8 +531,7 @@ class EmailDataParser {
* ticket filtering system. However, addresses in the Delivered-To header should never be
* considered for the collaborator list.
*/
$data['emailId'] = 0;
$data['recipients'] = array();
$tolist = array();
if (($to = $parser->getToAddressList()))
$tolist['to'] = $to;
......@@ -594,10 +602,6 @@ class EmailDataParser {
$data['flags']['bounce'] = TicketFilter::isBounce($data['header']);
}
$data['subject'] = $parser->getSubject();
$data['header'] = $parser->getHeader();
$data['mid'] = $parser->getMessageId();
$data['priorityId'] = $parser->getPriority();
$data['to-email-id'] = $data['emailId'];
if (($replyto = $parser->getReplyTo())) {
......
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -22,4 +22,3 @@ class JsSyntaxTest extends Test {
return 'JsSyntaxTest';
?>
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