php - need to add in_reply_to when using imap_append -
i`m trying append mail after send in sent mailbox...
public function append_mail($mail_box, $replyto, $from, $to, $subject, $text, $attaches = []){ $mailbox = "{".$this->imap_host.":".$this->imap_port.$this->imap_path."}".$mail_box; $dmy = date("d-m-y h:i:s"); $boundary = "------=".md5(uniqid(rand())); $msgid = $this->generatemessageid(); $msg = "from: $from\r\n"; $msg .= "to: $to\r\n"; $msg .= "date: $dmy\r\n"; $msg .= "message_id: $msgid\r\n"; $msg .= "in_reply_to: $replyto\r\n"; $msg .= "subject: $subject\r\n"; $msg .= "mime-version: 1.0\r\n"; $msg .= "content-type: multipart/mixed; boundary=\"$boundary\"\r\n"; $msg .= "\r\n\r\n"; $msg .= "--$boundary\r\n"; $msg .= "content-type: text/html;\r\n\tcharset=\"iso-8859-1\"\r\n"; $msg .= "content-transfer-encoding: 8bit \r\n"; $msg .= "\r\n\r\n"; $msg .= "$text\r\n"; if(!empty($attaches)) { $msg .= "\r\n\r\n"; $msg .= "--$boundary\r\n"; foreach ($attaches $filename => $filelink) { $attachment = chunk_split(base64_encode(file_get_contents($filelink))); $msg .= "content-transfer-encoding: base64\r\n"; $msg .= "content-disposition: attachment; filename=\"$filename\"\r\n"; $msg .= "\r\n" . $attachment . "\r\n\r\n"; } } $msg .= "\r\n\r\n\r\n"; $msg .= "--$boundary--\r\n\r\n"; imap_append($this->get_imap_stream(),$mailbox,$msg,"\\seen"); } protected function generatemessageid() { return sprintf( "<%s.%s@%s>", base_convert(microtime(), 10, 36), base_convert(bin2hex(openssl_random_pseudo_bytes(8)), 16, 36), $_server['server_name'] ); }
messahe appending sucessfully, when checking
imap_rfc822_parse_headers(imap_fetchheader($this->get_imap_stream(), $mail_id, ft_uid));
it not returning message_id , in_reply_to...
how can resolve problem???
i resolve problem parameters
$msg .= "message-id: $msgid\r\n"; $msg .= "in-reply-to: $replyto\r\n";
Comments
Post a Comment