私はマンドリルのメール送信を私のアプリと統合しようとしています。以下は私のコードです。
$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キーが表示されますが、同じエラーが発生します。