MDanz Posted September 6, 2015 Share Posted September 6, 2015 (edited) I'm attempting to reply to an email with php. I use php imap to fetch the email from the mail server and get the `message-id`.. i'm attempting to reply to the email but the email still shows up as a new message rather than a reply with threaded messages? $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to email: ' . imap_last_error()); $emails = imap_search($inbox,'ALL'); if($emails) { rsort($emails); foreach($emails as $email_number) { $overview = imap_fetch_overview($inbox,$email_number,0); $message_id = $overview[0]->message_id; $references[] = $overview[0]->message_id; } $references = implode(" ",$references); $headers = "From: <test@domain.co.uk> \r\n"; $headers .= "In-Reply-To: $message_id\r\n"; $headers .= "References: $references\r\n"; $headers .= "Content-Type: text/html;\r\n"; $subject = "testing"; $message = "test message2"; mail( "test2@domain.co.uk", $subject, $message, $headers ); How do i solve? I'm using the headers from http://www.jwz.org/doc/threading.html. Edited September 6, 2015 by MDanz Quote Link to comment https://forums.phpfreaks.com/topic/298082-replying-to-an-email-with-php-not-working/ Share on other sites More sharing options...
ginerjm Posted September 7, 2015 Share Posted September 7, 2015 Have you checked the manual yet? Read thru the Imap functions. Quote Link to comment https://forums.phpfreaks.com/topic/298082-replying-to-an-email-with-php-not-working/#findComment-1520423 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.