【发布时间】:2014-03-25 15:55:50
【问题描述】:
当我们的服务器收到更新(通常与付款有关)时,我正在使用 PHPMailer 发送电子邮件以支持支持。
我正在尝试将相关电子邮件显示为 Gmail 对话,以便支持人员更轻松地跟踪以前的更新/回复。我原本以为它是基于主题的,但这似乎并没有什么不同。
我的邮件代码:
$mail = new PHPMailer; // create a new instance
$mail->isSMTP(); // set that we're using stmp
$mail->CharSet = 'UTF-8'; // make sure it's utf-8 encoded
$mail->Host = 'smtp.gmail.com'; // the hostname of the mail server
$mail->Port = 587; // set the smtp port number (587 for authenticated TLS)
$mail->SMTPSecure = 'tls'; // set the encryption to use, ssl (deprecated) or tls
$mail->SMTPAuth = true; // should we use smtp authentication?
$mail->Username = MY_EMAIL_LOGIN; // the user name for the smtp authentication
$mail->Password = MY_EMAIL_PASSWORD; // the password for smtp authentication
$mail->wordWrap = 70; // make sure we've no lines longer than 70 chars
$mail->Subject = "[Payment] - Player {$payment->user->name} ({$payment->user->id}) - Payment ID {$payment->id}";
$mail->Body = $htmlBody; // our html body
$mail->AltBody = $plainBody; // our fallback, plain-text body
$mail->setFrom( SUPPORT_EMAIL, 'Support' ); // who this is from
$mail->addReplyTo( SUPPORT_EMAIL, 'Support' ); // who we can reply to
$mail->addAddress( SUPPORT_EMAIL ); // who we're sending it to
$mail->isHTML( true ); // is this a html formatted email?
if( !$mail->send() )
error_log( "Can't send an email to support about payment {$payment->id} for user {$payment->user->id}" );
如果我收到来自同一用户的 2 封与同一付款相关的电子邮件(因此主题相同),我希望它以如下形式出现:
+-----------------------------------------------------------------------------+
| Support (2) | [Payment] Player foo (123456789) - Payment ID 123456789 |
+-----------------------------------------------------------------------------+
实际上是这样的:
+-----------------------------------------------------------------------------+
| Support | [Payment] Player foo (123456789) - Payment ID 123456789 |
+-----------------------------------------------------------------------------+
| Support | [Payment] Player foo (123456789) - Payment ID 123456789 |
+-----------------------------------------------------------------------------+
我错过了一些简单的东西吗?
【问题讨论】: