diff --git a/include/api.tickets.php b/include/api.tickets.php
index 59f6c6f5a8b5fbb093fdd59ac97e675dde964639..afad901d50593b06693771ae43f854612fdd3c87 100644
--- a/include/api.tickets.php
+++ b/include/api.tickets.php
@@ -20,7 +20,8 @@ class TicketApiController extends ApiController {
 
         if(!strcasecmp($format, 'email'))
             $supported = array_merge($supported, array('header', 'mid',
-                'emailId', 'ticketId', 'reply-to', 'reply-to-name'));
+                'emailId', 'ticketId', 'reply-to', 'reply-to-name',
+                'in-reply-to', 'references'));
 
         return $supported;
     }
@@ -115,7 +116,7 @@ class TicketApiController extends ApiController {
 
         if (($thread = ThreadEntry::lookupByEmailHeaders($data))
                 && $thread->postEmail($data)) {
-            return true;
+            return $thread->getTicket();
         }
         return $this->createTicket($data);
     }
diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index d224b9fe739a2f1db30cef8713cbe0ef4737d38b..f0ae3842ed9b70a52af2c4c5d206b8188d40c209 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -341,6 +341,9 @@ class EmailDataParser {
         $data['priorityId'] = $parser->getPriority();
         $data['emailId'] = $emailId;
 
+        $data['in-reply-to'] = $parser->struct->headers['in-reply-to'];
+        $data['references'] = $parser->struct->headers['references'];
+
         if ($replyto = $parser->getReplyTo()) {
             $replyto = $replyto[0];
             $data['reply-to'] = $replyto->mailbox.'@'.$replyto->host;