Mandrill使用SwiftMailer进行报告


Mandrill reports using SwiftMailer?

我正在通过SwiftMailers脚本连接到Mandrill的SMTP,但我在Mandrill中没有看到我通过Swift发送的电子邮件的报告。为什么会发生这种情况?

这是我连接到Mandrill的代码(它都在正常工作并发送邮件)

    include_once "../swift_required.php";
    $transport = Swift_SmtpTransport::newInstance('smtp.mandrillapp.com', 465, 'ssl');
    $transport->setUsername('our@email.com');
    $transport->setPassword('api-key-goes-here');
    $swift = Swift_Mailer::newInstance($transport);

您需要设置SMTP标头:

$message = Swift_Message::newInstance();
$headers = $message->getHeaders();
$headers->addTextHeader('X-MC-Track', 'opens, clicks_htmlonly');

查看更多,http://help.mandrill.com/entries/21688056-Using-SMTP-Headers-to-customize-your-messages.