【问题标题】:Mandrill and PHP not sending transactional email outMandrill 和 PHP 不发送交易电子邮件
【发布时间】:2014-03-03 19:46:45
【问题描述】:

所以我在 Mandrill 中制作了一个名为“Basic”的模板。我做了一个测试发送,它看起来很棒。我将 Mandrill 置于测试模式,并在我的代码中使用了测试 API 密钥。我只是想让 php 发送一封测试交易电子邮件,但没有发送任何电子邮件。这是我得到的打印回复:

Array ( [0] => Array ( [email] => amiecrutchley02@gmail.com [status] => sent [_id] => 89bfab4c3938486eb9e36564f79a3e9f [reject_reason] => ) )

所以我真的不知道为什么我没有收到任何东西。

这是我的代码:

<?php 
require_once('includes/mandrill/Mandrill.php');

$mandrill = new Mandrill('my_api_key');

$message = array(
    'subject' => 'Thank You For Your Purchase',
    'from_email' => 'no-reply@acq.com',
    'from_name' => 'ACQ',
    'to' => array(array('email' => 'amiecrutchley02@gmail.com', 'name' => 'Amie')),
    'merge_vars' => array(array(
        'rcpt' => 'amiecrutchley02@gmail.com',
        'vars' =>
        array(
            array(
                'name' => 'FIRSTNAME',
                'content' => 'Amie'),
            array(
                'name' => 'LASTNAME',
                'content' => 'Crutchley')
    ))));

$template_name = 'Basic';

$template_content = array(
    array(
        'name' => 'main',
        'content' => 'Hi *|FIRSTNAME|* *|LASTNAME|*, your profile has been updated!'),
    array(
        'name' => 'footer',
        'content' => 'ACQ, Copyright 2014')

);

$response = $mandrill->messages->sendTemplate($template_name, $template_content, $message);
print_r($response);


?>

【问题讨论】:

    标签: php email mailchimp mandrill transactional-email


    【解决方案1】:

    测试 API 密钥专门设计用于发送电子邮件。它的设计目的是让您可以模仿发送电子邮件,但实际上并不发送。您也无需为发送测试付费。这是关于什么是测试模式及其工作原理的 Mandrill KB:Does Mandrill have a test mode or sandbox?

    【讨论】:

      【解决方案2】:

      嗯,很奇怪,但我的测试 API 是问题所在。我尝试了公共 API 和繁荣!有效!

      【讨论】:

        猜你喜欢
        • 2011-05-18
        • 2014-05-30
        • 2015-10-13
        • 2014-12-02
        • 2014-05-04
        • 2013-06-22
        • 1970-01-01
        • 2016-07-04
        • 2015-04-23
        相关资源
        最近更新 更多