简体   繁体   English

发送电子邮件Transport Mandrill失败

[英]Send email Transport Mandrill failed

I fought enough to be able to send an email from the API KEY Mandrill with a user it provides me if you have your account. 我已经竭尽所能,可以与API KEY Mandrill一起向用户(如果您拥有自己的帐户)发送电子邮件。 I could find the answer and leave the answer here in case someone else serves. 我可以找到答案,并在此处保留答案,以防有人服务。

MandrillTransport Mandrill运输

Config Mandrill in email.php 在email.php中配置Mandrill

public $mandrill = array(
    'transport' => 'Mandrill',
    'uri' => 'https://mandrillapp.com/api/1.0/',
    'api_key' => 'YR3eo8WM9F-Je2********',
);

My code email : 我的验证码电子邮件:

$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);

Response : 回应:

[Mandrill] => Array
    (
        [status] => error
        [code] => -1
        [name] => Invalid_Key
        [message] => Invalid API key
    )

Under these circumstances you receive this error message (rare for me, since the api key is fine). 在这种情况下,您会收到此错误消息(对我来说很少,因为api键很好)。

EDIT 编辑

I realized thanks to the example used instead of api_key key but only rough with change : 我意识到,由于使用了示例而不是api_key键,但仅通过更改就可以了:

'api_key' to 'key' => $apikey,

I realized thanks @César to the example used instead of api_key but key only rough with change in my config : 我意识到感谢@César而不是api_key所使用的示例,但仅对我的配置进行了更改才大致输入了密钥:

public $mandrill = array(
    'transport' => 'Mandrill',
    'uri' => 'https://mandrillapp.com/api/1.0/',
    'key' => 'YR3eo8WM9F-Je2********',
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM