Closed qroac closed 3 years ago
Is it works for you now?
If not, try to run this example from separate php file:
$mj = new \Mailjet\Client(MY_KEY, MY_SECRET);
$body = [
'Email' => 'somebody@domain.com',
];
$response = $mj->post(\Mailjet\Resources::$Contact, ['body' => $body]);
$response->success();
print_r($response->getData());
and run it, should print something like that:
Array
(
[0] => Array
(
[CreatedAt] => 2020-09-23T19:57:43Z
[DeliveredCount] => 0
[Email] => somebody@domain.com
[ExclusionFromCampaignsUpdatedAt] =>
[ID] => 207971375
[IsExcludedFromCampaigns] =>
[IsOptInPending] =>
[IsSpamComplaining] =>
[LastActivityAt] =>
[LastUpdateAt] =>
[Name] =>
[UnsubscribedAt] =>
[UnsubscribedBy] =>
)
)
or it can be DNS problems on your host
HI, I had the same problem : I use v3.1 and you need to specify v3 when you want to manipulate contact ...
Instead of
$mj = new \Mailjet\Client(MY_KEY, MY_SECRET);
Write :
$mj = new \Mailjet\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'),true,['version' => 'v3']);
I try to add a new contact as described. My request always ends up returning status code 404 - not found.
Is there anything I am missing?