Codeigniter - Sending email with gmail smtp with codeigniter email library
class email2 extends MY_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
$config = array();
$config['useragent'] = "CodeIgniter";
$config['mailpath'] = "/usr/bin/sendmail"; // or "/usr/sbin/sendmail"
$config['protocol'] = "smtp";
$config['smtp_host'] = "ssl://smtp.gmail.com";
$config['smtp_port'] = "465";
$config['smtp_user'] = "xxxxx@gmail.com";
$config['smtp_pass'] = "xxxxx";
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['wordwrap'] = TRUE;
$this->load->library('email');
$this->email->initialize($config);
$this->email->from('xxxxx@gmail.com', 'admin');
$this->email->to('xxxxx@gmail.com');
$this->email->cc('zzzzz@gmail.com');
$this->email->bcc($this->input->post('email'));
$this->email->subject('Registration Verification: Continuous Imapression');
$msg = "Thanks for signing up!
Your account has been created,
you can login with your credentials after you have activated your account by pressing the url below.
Please click this link to activate your account:Click Here";
$this->email->message($msg);
//$this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));
$this->email->send();
echo $this->email->print_debugger();
}
}
?>
Comments
Post a Comment