In-Reply-to和Reference已添加到电子邮件标题中,但仍作为新邮件发送但未回复

时间:2016-12-06 15:03:50

标签: email smtp phpmailer email-headers

我正在尝试回复"通过PHPmailer发送电子邮件,但不是"发送新电子邮件",但即使In-Reply-to和Reference已添加到电子邮件标题中,我也会失败,这意味着它显示它仍然是一封新邮件,原始邮件电子邮件从未被回复。谢谢你的帮助。

我的代码:

  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)');

通过phpmailer发送的电子邮件标题(我失败了,这意味着仍然是新邮件但没有回复)

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"

这是成功回复电子邮件的标题,即网络回复

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

1 个答案:

答案 0 :(得分:1)

这看起来像你使用的是非常旧版本的PHPMailer;多年来它一直没有在sourceforge上维护,2010年发布了5.1.0! Get the latest。你为什么要看PHPMailer的内部?您应该只是致电addCustomHeader()添加所需的标题:

$mail->addCustomHeader('References', '<tencent_205C6E0F42D57AD16CFF6B9C@test.com>');
$mail->addCustomHeader('In-Reply-To', '<tencent_205C6E0F42D57AD16CFF6B9C@test.com>');