Generalization of the mail sending process
This commit is contained in:
parent
0d52f7ea98
commit
7345730057
|
@ -74,7 +74,7 @@
|
||||||
$route['f/(:any)'] = '/file/open/$1';
|
$route['f/(:any)'] = '/file/open/$1';
|
||||||
$route['f/(:any)/(:any)'] = '/file/open/$1/$2';
|
$route['f/(:any)/(:any)'] = '/file/open/$1/$2';
|
||||||
$route['logout'] = 'login/logout';
|
$route['logout'] = 'login/logout';
|
||||||
$route['activate'] = 'login/activate';
|
$route['activate/(:any)/(:any)'] = 'login/activate/$1/$2';
|
||||||
$route['register'] = 'login';
|
$route['register'] = 'login';
|
||||||
$route['reset/(:any)/(:any)'] = 'login/reset/$1/$2';
|
$route['reset/(:any)/(:any)'] = 'login/reset/$1/$2';
|
||||||
$route['tools/twitch/(:any)'] = 'tools/twitch?twich-channel=$1';
|
$route['tools/twitch/(:any)'] = 'tools/twitch?twich-channel=$1';
|
||||||
|
|
29
application/models/EmailModel.php
Normal file
29
application/models/EmailModel.php
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||||
|
|
||||||
|
use Coduo\PHPHumanizer\DateTimeHumanizer;
|
||||||
|
|
||||||
|
class EmailModel extends CI_Model
|
||||||
|
{
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendMail($recipient, $subject, $template, $templateData) {
|
||||||
|
$this->load->library('email');
|
||||||
|
|
||||||
|
$config['mailtype'] = 'html';
|
||||||
|
$this->email->initialize($config);
|
||||||
|
|
||||||
|
$this->email->from('no-reply@kingofdog.eu', 'KingOfDog');
|
||||||
|
$this->email->to($recipient);
|
||||||
|
|
||||||
|
$this->email->subject($subject);
|
||||||
|
$this->email->message($this->load->view('emails/', $template, $templateData, true));
|
||||||
|
|
||||||
|
$this->email->send();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->load->model('NotificationModel', '', TRUE);
|
$this->load->model('NotificationModel', '', TRUE);
|
||||||
|
$this->load->model('EmailModel', '', TRUE);
|
||||||
$this->load->helper('cookie');
|
$this->load->helper('cookie');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,23 +119,9 @@
|
||||||
|
|
||||||
$this->db->cache_delete('admin', 'users');
|
$this->db->cache_delete('admin', 'users');
|
||||||
|
|
||||||
$this->load->library('email');
|
$this->EmailModel->sendMail($email, 'Aktiviere deinen Account und lege so richtig los auf KingOfDog.eu', 'register', ['username' => $username, 'emailHash' => md5($email), 'activationKey' => $activation_key]);
|
||||||
|
|
||||||
$config['mailtype'] = 'html';
|
|
||||||
$this->email->initialize($config);
|
|
||||||
|
|
||||||
$this->email->from('no-reply@kingofdog.eu', 'KingOfDog');
|
|
||||||
$this->email->to($email);
|
|
||||||
|
|
||||||
$this->email->subject('Aktiviere deinen Account und lege so richtig los auf KingOfDog.eu');
|
|
||||||
$this->email->message($this->load->view('emails/register', ['username' => $username, 'emailHash' => md5($email), 'activationKey' => $activation_key], true));
|
|
||||||
|
|
||||||
$this->email->send();
|
|
||||||
|
|
||||||
// TODO: TRANSLATE
|
// TODO: TRANSLATE
|
||||||
// $message = "Hallo, bitte aktiviere deinen Account: " . base_url('activate/' . md5($email) . '/' . $activation_key);
|
|
||||||
// TODO: Send email
|
|
||||||
// mail($email, "Aktiviere deinen Account und lege so richtig los auf KingOfDog.eu", $message);
|
|
||||||
|
|
||||||
// Send notification
|
// Send notification
|
||||||
$createdUser = $this->db->query('SELECT ID FROM users WHERE username = ?', [$username])->result_array();
|
$createdUser = $this->db->query('SELECT ID FROM users WHERE username = ?', [$username])->result_array();
|
||||||
|
|
Reference in New Issue
Block a user