4

I am trying to "reply" email via PHPmailer, but not "sending a new email", but I fail even the In-Reply-to and Reference had been added to email header, that means it shows it is still a new email, the original email never been reply. Thanks for help.

My code:

  if($this->MessageID != '') {
  $result .= $this->HeaderLine('Message-ID',$this->MessageID);
} else {
  $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
}

    if($this->References != ''){
            $result .= $this->HeaderLine('References',$this->References);
    }

    if($this->InReplyTo != ''){
            $result .= $this->HeaderLine('In-Reply-To',$this->InReplyTo);
    }

$result .= $this->HeaderLine('X-Priority', $this->Priority);
$result .= $this->HeaderLine('X-Mailer', 'PHPMailer '.$this->Version.' (phpmailer.sourceforge.net)');

The email header that send via phpmailer (which I fail,that means still a new email but not reply)

Date: Sat, 3 Dec 2016 17:01:21 +0800
To: Eric <erichu@test.com>
From: support <support@test.com>
Subject: Re:testemail12031604
Message-ID: <tencent_0634F549045841EE1B94753E@test.com>
References: <tencent_205C6E0F42D57AD16CFF6B9C@test.com>
In-Reply-To: <tencent_205C6E0F42D57AD16CFF6B9C@test.com>
X-Priority: 3
X-Mailer: PHPMailer 5.1 (phpmailer.sourceforge.net)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_39519ee60f388e1a9b9a9ec312ae2071"

and this is header of a success reply email, that reply in web

From: "=?utf-8?B?RWxhaW5l?=" <support@test.com>
To: "=?utf-8?B?RXJpYw==?=" <erichu@test.com>
Subject: Re:hubreplytestemail12031604
Mime-Version: 1.0
Content-Type: multipart/alternative;
    boundary="----=_NextPart_5842871D_0A6F1F10_2B4284B6"
Content-Transfer-Encoding: 8Bit
Date: Sat, 3 Dec 2016 16:49:33 +0800
X-Priority: 3
Message-ID: <tencent_477F7F80668628EB4A87C531@test.com>
X-QQ-MIME: TCMime 1.0 by Tencent
X-Mailer: QQMail 2.x
X-QQ-Mailer: QQMail 2.x
References: <tencent_205C6E0F42D57AD16CFF6B9C@test.com>
In-Reply-To: <tencent_205C6E0F42D57AD16CFF6B9C@test.com>
X-QQ-ReplyHash: 2325734638
Henry
  • 2,953
  • 2
  • 21
  • 34
user7256420
  • 41
  • 1
  • 3

1 Answers1

0

This looks like you're using a very old version of PHPMailer; It's not been maintained on sourceforge for years, 5.1.0 was released in 2010! Get the latest. Why are you even looking at the internals of PHPMailer? You should just be calling addCustomHeader() to add the headers you want:

$mail->addCustomHeader('References', '<tencent_205C6E0F42D57AD16CFF6B9C@test.com>');
$mail->addCustomHeader('In-Reply-To', '<tencent_205C6E0F42D57AD16CFF6B9C@test.com>');
Synchro
  • 35,538
  • 15
  • 81
  • 104