function unsubscribe() { $email_id = strtolower($this->input->post('subscribe_email')); $data = array(); if (valid_email($email_id)) { $this->database->Unsubscribe($email_id); mg_unsubscribe($email_id); $data['email_id'] = $email_id; $data['heading'] = "You have been Unsubscribed"; $data['content'] = "So this is the end of us. Take care and stay Psycho anyways."; } display('basic', $data); }
function webhooks() { //Manage mailgun callbacks $mailgun_post = $this->input->post(); switch ($mailgun_post['event']) { case 'unsubscribed': $email = $mailgun_post['recipient']; $this->database->Unsubscribe($email); mg_unsubscribe($email); break; default: # code... break; } }