【发布时间】:2016-07-05 05:59:17
【问题描述】:
如果您有自己的帐户,我已经竭尽全力能够从 API KEY Mandrill 向它提供给我的用户发送电子邮件。我可以找到答案并在此处留下答案,以防其他人提供服务。
在 email.php 中配置 Mandrill
public $mandrill = array(
'transport' => 'Mandrill',
'uri' => 'https://mandrillapp.com/api/1.0/',
'api_key' => 'YR3eo8WM9F-Je2********',
);
我的代码邮箱:
$email = new CakeEmail();
$email->config('mandrill');
$email->from('example@example.com');
$email->to('example2@example.com');
$email->subject('Subject for Email');
$result = $email->send('Here is some test content for the email.');
print_r($result);
回应:
[Mandrill] => Array
(
[status] => error
[code] => -1
[name] => Invalid_Key
[message] => Invalid API key
)
在这些情况下,您会收到此错误消息(对我来说很少见,因为 api 密钥很好)。
编辑
我意识到这要归功于使用的示例而不是 api_key 键,但只是粗略的改变:
'api_key' to 'key' => $apikey,
【问题讨论】:
-
github页面上的示例使用
key作为数组的键。不是api_key
标签: php email cakephp mandrill