function test_email() { if (!$this->auth) { $this->error('403', 'Forbidden'); return; } $email = $this->input->post('delivery_address'); $sender = $this->input->post('sender'); Shutter::email($email, $email, $email, '[' . $_SERVER['HTTP_HOST'] . '] Koken email test', 'Message received! Your Koken email configuration appears to be working fine.', $sender); exit; }
function reset_password($id = false) { $koken_url_info = $this->config->item('koken_url_info'); $this->load->library('email'); if (isset($_POST['email']) && !empty($_POST['email'])) { $user = $_POST['email']; $u = new User(); $u->where('email', $user)->get(); if ($u->exists()) { $subject = 'Koken: Password reset requested'; $message = "Hi there -\n\nSomeone (hopefully you!) just requested that the password to your Koken installation at {$koken_url_info->base} be reset. If you did not request a password reset, ignore this email and your password will stay the same. If you do need your password reset, click the link below.\n\n{$koken_url_info->base}api.php?/users/reset_password/{$u->internal_id}\n\n- Koken"; Shutter::email($u->email, 'Koken', $u->email, $subject, $message); $this->set_response_data(array('success' => true)); } else { $this->error('404', 'User not found.'); return; } } else { if ($id) { $u = new User(); $u->where('internal_id', $id)->get(); if ($u->exists()) { $new = substr(koken_rand(), 0, 8); $u->password = $new; $u->save(); $subject = 'Koken: Your password has been reset'; $message = "Your Koken password has been successfully reset.\n\nYour new password: {$new}\n\n- Koken"; Shutter::email($u->email, 'Koken', $u->email, $subject, $message); header("Location: {$koken_url_info->base}admin/#/reset"); exit; } else { $this->error('404', 'User not found.'); return; } } else { $this->error('400', 'Bad request'); return; } } }
protected final function deliver_email($from, $from_name, $subject, $message) { Shutter::email($from, $from_name, null, $subject, $message); }