I am using mailgun API. I want to keep thread when I reply to mail using Mailgun API.
Let me explain. I fetch mail using IMAP. I have message_id,subject,text,sender mail etc. Now I reply to that mail using Mailgun API. Here i face problem. I replied with same subject to that email-id but that person get mail as a new mail. Thread is not generated. In Php Mailer i find following way so thread is generated. But how to create thread using Mailgun API.
$mail->AddCustomHeader('In-Reply-To', $message_id);
$mail->addCustomHeader('References', $message_id);
Thanks in advance.
Finally i got solution. Hope this will help someone.
$mail->addHeader('Your-Header', 'value');
example:
$mail->addHeader('Reply-to', $message_id);