Mandrill抛出一个未定义的错误

时间:2014-05-20 20:29:54

标签: php email mandrill

我开始尝试使用Mandrill作为我的php邮件解决方案但是遇到了一堵砖墙。我已经按照他们的php教程导致了以下代码:

require_once 'Mandrill.php'; //Not required with Composer

try{
$mandrill = new Mandrill('API KEY IS PLACED');

// *** Storying the content

$emailSubject = $_POST['subject'];
$fromEmail = $_POST['from'];
$groupTo = $_POST['inquiry'];
$personsName = $_POST['name'];
$phoneNumber = $_POST['phone'];
$streetAddress = $_POST['address'];
$comments = $_POST['message'];
$htmlComments = str_replace("\n", '<br />', $comments);

$textContent = "$personsName \n" .
    "$phoneNumber \n" .
    "$streetAddress \n" .
    "comments \n"
;

$htmlContent = "<p><strong>$personsName</strong><p>
        <p>$phoneNumber</p> 
        <p>$streetAddress</p> 
        <p>$htmlComments</p>";

$message = array(
    'headers' => array(
        'Reply-To' => $groupTo 
    ),
    'subject' => $emailSubject,
    'from_name' => $personsName,
    'from_email' => $fromEmail,
    'html' => $htmlContent,
    'text' => $textContent,
    'to' => array(array('email' => 'testing@email.net', 'name' => $personsName))
);

$async = false;
$ip_pool = null;
$send_at = null;

$result = $mandrill->messages->send($message, $async, $ip_pool, $send_at);
print_r($result);
}
catch(Mandrill_Error $e){
// Mandrill errors are thrown as exceptions
    echo 'A mandrill error occurred: ' . get_class($e) . ' - ' . $e->getMessage();
// A mandrill error occurred: Mandrill_Unknown_Subaccount - No subaccount exists with the id 'customer-123'
    throw $e;
}

// Testing Vars
//var_dump($result);die();

由于捕获,我收到错误,但这是一个不起眼的错误。打印出来的是

Array ( [0] => Array ( [email] => testing@email.net [status] => sent [_id] => ceb9b2d536824fbaa3c03e38e86035e6 [reject_reason] => ) )

发送的[_id]每次都明​​显不同。我不知道为什么会被拒绝。我知道的代码中没有任何错误。我已经在本地进行了测试并且每次都能获得相同的结果。

我错过了什么?

1 个答案:

答案 0 :(得分:0)

嗯,我觉得自己像个小丑。邮件正在发送,并不会发送垃圾邮件。问题是我的邮件客户端。它没有收到邮件。

访问网络邮件界面,就在那里。

不确定如何标记这个。我应该删除吗?或者它有价值吗?