我正在使用 Mailjet 为时事通讯添加订阅者。如何检查电子邮件是否已订阅。
我之前使用过以下方法,但不检查或返回电子邮件是否已订阅,或者不只是更新它并返回响应成功。
这是我的代码:
$mj = new \Mailjet\Client(MJ_APIKEY_PUBLIC, MJ_APIKEY_PRIVATE);
// CREATE CONTACT AND SUBSCRIBE AT ONCE
// Adding User into Mailjet Contact as Subscriber for Newsletter
$body = [
'Email' => $POST['email'],
'Name' => $POST['name'],
'Action' => "addnoforce",
];
$contactlistID = 3;
$response = $mj->post(\Mailjet\Resources::$ContactslistManagecontact, ['id' => $contactlistID, 'body' => $body]);
// Read the response
if ($response->success()) {
$feedback = array('type' => 'success', 'msg' => 'Your email has been registered succesfully.');
}
希望有解决方案,非常感谢。