public function error_handling() { $obj = new MailJetEvents(Tools::getValue('event'), Tools::getValue('time')); $obj->add(); header('HTTP/1.1 200 OK'); die; }
$post = trim(Tools::file_get_contents('php://input')); # No Event sent if (empty($post)) { header('HTTP/1.1 421 No event'); /* => do action */ return; } # Decode Trigger Informations $t = Tools::jsonDecode($post, true); # No Informations sent with the Event if (!is_array($t) || !isset($t['event'])) { header('HTTP/1.1 422 Not ok'); /* => do action */ return; } $events = new MailJetEvents($t['event'], $t); /* * Event handler * - please check https://www.mailjet.com/docs/event_tracking for further informations. */ switch ($t['event']) { case 'open': /* => do action */ /* If an error occurs, tell Mailjet to retry later: header('HTTP/1.1 400 Error'); */ /* If it works, tell Mailjet it's OK */ header('HTTP/1.1 200 Ok'); break; case 'click': /* => do action */ break; case 'bounce':