Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.02 KB | None | 0 0
  1. <?php
  2. require_once __DIR__ . '/vendor/autoload.php';
  3. defined('BASEPATH') OR exit('No direct script access allowed');
  4. define('EMAIL_HOST','EMAIL_HOST_HERE');
  5. define('EMAIL_PORT','EMAIL_PORT_HERE');
  6. define('EMAIL_USER','EMAIL_USER_HERE');
  7. define('EMAIL_PASS','EMAIL_PASS_HERE');
  8. class EmailModel extends CI_Model{
  9.     public function sendMail($email,$name,$title,$body){
  10.       $ci = get_instance();
  11.       $config['protocol'] = "smtp";
  12.       $config['smtp_host'] = EMAIL_HOST;
  13.       $config['smtp_port'] = EMAIL_PORT;
  14.       $config['smtp_user'] = EMAIL_USER;
  15.       $config['smtp_pass'] = EMAIL_PASS;
  16.       $config['charset'] = "utf-8";
  17.       $config['mailtype'] = "html";
  18.       $config['newline'] = "\r\n";
  19.       $ci->email->initialize($config);
  20.       $ci->email->from('no-reply@valeriandwi.com', 'Elder Protect');
  21.       $ci->email->to($email);
  22.       $ci->email->subject($title);
  23.       $ci->email->message($body);
  24.       if ($this->email->send()) {
  25.         return true;
  26.       } else {
  27.         return false;
  28.       }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement