Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to send email using Codeigniter

by
Category:codeigniter
codeigniter mysql
How to send email using Codeigniter

In this tutorial, I will describe how to send emails in a CodeIgniter application using SMTP. I will use the well known and maintained email sending class.

Code

$this->load->library('email');

$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);

$this->email->to("example@gmail.com");
$this->email->from('demo@gmail.com');
$this->email->subject("Testing");
$this->email->message("Type your message");
$this->email->send();

2 Comments

hardik patel

14 Feb 2018

this code is workable in localhost?
Hardik

18 Jun 2018

No Hardik!

Html code work in comment box


Related Post