Generalization of the mail sending process
This commit is contained in:
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();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user