标签:php codeigniter mailchimp email-integration
我只想尝试将mandrill邮件发送到我的应用程序下面是我在php中的代码
$args = array(
'key' => '73357ad2-e59e-4669---------',
'message' => array(
"html" => "<p>\r\n\tHi Adam,</p>\r\n<p>\r\n\tThanks for <a href=\"http://mandrill.com\">registering</a>.</p>\r\n<p>etc etc</p>",
"text" => null,
"from_email" => "xxx@xxx.com",
"from_name" => "SIVOnline",
"subject" => "Your recent registration",
"to" => array(array("email" => "xxx@xxx.com")),
"track_opens" => true,
"track_clicks" => true,
"auto_text" => true
)
);
// Open a curl session for making the call
$curl = curl_init('https://mandrillapp.com/api/1.0/messages/send.json' );
// Tell curl to use HTTP POST
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
// Tell curl not to return headers, but do return the response
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
// Set the POST arguments to pass on
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($args));
// Make the REST call, returning the result
$response = curl_exec($curl);
// Close the connection
curl_close( $curl );
并且在重新生成密钥后它给我无效的api密钥仍然我得到相同的错误.
解决方法:
将$args变量传递给CURLOPT_POSTFIELDS setopt调用时,不要对其进行JSON编码.
顺便说一句,您应该首先尝试进行用户/ ping呼叫.
标签:php,codeigniter,mailchimp,email-integration 来源: https://codeday.me/bug/20190621/1250084.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。