任何人都可以告诉我如何使用curl与mixmax发送电子邮件签名文本,
mixmax电子邮件发送功能已经正常工作。
$data = array('message' => array('to' => $toEmail, 'from' => 'email_id', "subject" => $subject, "html" => $content));
$data_string = json_encode($data);
$ch = curl_init('https://api.mixmax.com/v1/send/');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'X-API-Token: API key here',
'accept-encoding: gzip, deflate',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
if(curl_error($ch))
{
return false;
}else{
return true;
}
curl_close ($ch);