Mandrill 未显示正确的抄送信息

问题描述 投票:0回答:2

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

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

当我在 [电子邮件受保护] 上看到电子邮件标题时。它总是显示没有抄送,并且该电子邮件发送“至”[电子邮件受保护],而不是抄送

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

php mandrill
2个回答
16
投票

您需要将选项

preserve_recipients
设置为
true

$message = array(
    'html' => '<p>Example HTML content</p>',
    'text' => 'Example text content',
    'subject' => 'example subject',
    'from_email' => '[email protected]',
    'from_name' => 'Example Name',
    'to' => array(
        array(
            'email' => '[email protected]',
            'name' => 'Recipient Name',
            'type' => 'to'
        ),
        array(
            'email' => '[email protected]',
            'name' => 'Recipient Name',
            'type' => 'cc'
        )
    ),
    'headers' => array('Reply-To' => '[email protected]'),
    'preserve_recipients' => true
);

0
投票

如果有人在使用 Django+Anymail 时面临同样的问题,那么您需要在您的

settings.py
文件中进行设置

ANYMAIL = {
    "MANDRILL_API_KEY": env.str("MANDRILL_API_KEY"),
    "MANDRILL_SEND_DEFAULTS": {
        "esp_extra": {
            "message": {
                "preserve_recipients": True
            }
        }
    }
}
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.