Mandrill 未显示正确的抄送信息

Nik*_*Lau 6 php mandrill

在过去的几个小时里,这个问题真的让我发疯了。为什么使用 Mandrill 发送的电子邮件没有显示有关抄送电子邮件地址的正确信息。

例如,我想发送电子邮件至

  • receiver_to_a@mail.com
  • receiver_cc_a@mail.com
  • receiver_cc_b@mail.com

当我在receiver_cc_a@mail.com 上看到电子邮件标题时。它总是显示没有抄送,并且该电子邮件发送“到”receiver_cc_a@mail.com,而不是抄送

有没有人有同样的问题?我已经尝试使用 PHPMailer 使用 PHP 发送电子邮件,也尝试使用 Mandrill 本身的 PHP API,但没有成功。

Fek*_*ied 6

您需要将该选项设置preserve_recipientstrue.

$message = array(
    'html' => '<p>Example HTML content</p>',
    'text' => 'Example text content',
    'subject' => 'example subject',
    'from_email' => 'message.from_email@example.com',
    'from_name' => 'Example Name',
    'to' => array(
        array(
            'email' => 'recipient.email@example.com',
            'name' => 'Recipient Name',
            'type' => 'to'
        ),
        array(
            'email' => 'ccrecipient.email@example.com',
            'name' => 'Recipient Name',
            'type' => 'cc'
        )
    ),
    'headers' => array('Reply-To' => 'message.reply@example.com'),
    'preserve_recipients' => true
);
Run Code Online (Sandbox Code Playgroud)