Mailjet 如何查看邮件是否被订阅
Mailjet How to check email has been subscribed or not
我正在使用 Mailjet 添加时事通讯订阅者。
如何查看邮件是否已订阅
我之前使用过以下方法但没有检查或return电子邮件已被订阅或不只是更新它并且return响应成功。
这是我的代码:
$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.');
}
希望有解决方案,非常感谢。
回复也包含 $response->success
详细信息,您可以通过以下方式轻松查看它们:
$response->getData()
array(1) {
[0]=>
array(5) {
["ContactID"]=>
int(1682906939)
["Email"]=>
string(14) "gbadi@test.com"
["Action"]=>
string(10) "addnoforce"
["Name"]=>
string(13) "Test"
["Properties"]=>
array(0) {
}
}
}
如需事后查询,可拨打Resources::$ContactGetcontactslists
$response = $mailjet->get(Resources::$ContactGetcontactslists, [
'id' => 'email or id'
]);
var_dump($response->getData());
var_dump($response->success());
var_dump($response->getStatus());
哪个会 return
array(1) {
[0]=>
array(3) {
["IsActive"]=>
bool(true)
["IsUnsub"]=>
bool(false)
["ListID"]=>
int(1)
}
}
bool(true)
int(200)
我正在使用 Mailjet 添加时事通讯订阅者。 如何查看邮件是否已订阅
我之前使用过以下方法但没有检查或return电子邮件已被订阅或不只是更新它并且return响应成功。
这是我的代码:
$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.');
}
希望有解决方案,非常感谢。
回复也包含 $response->success
详细信息,您可以通过以下方式轻松查看它们:
$response->getData()
array(1) {
[0]=>
array(5) {
["ContactID"]=>
int(1682906939)
["Email"]=>
string(14) "gbadi@test.com"
["Action"]=>
string(10) "addnoforce"
["Name"]=>
string(13) "Test"
["Properties"]=>
array(0) {
}
}
}
如需事后查询,可拨打Resources::$ContactGetcontactslists
$response = $mailjet->get(Resources::$ContactGetcontactslists, [
'id' => 'email or id'
]);
var_dump($response->getData());
var_dump($response->success());
var_dump($response->getStatus());
哪个会 return
array(1) {
[0]=>
array(3) {
["IsActive"]=>
bool(true)
["IsUnsub"]=>
bool(false)
["ListID"]=>
int(1)
}
}
bool(true)
int(200)