Send authenticated email in Codeigniter

This topic helps the php developers to send email in php codeigniter.

$htmlContent="entire html content will come here";
$this->load->library("email");
$config['mailtype'] = 'html';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://mailhost.com';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'support@website.com';
$config['smtp_pass'] = 'emailidpassword';
$config['charset'] = 'utf-8';
$config['priority'] = '1';
$config['newline']    = "\r\n";
$config['validation'] = TRUE;
$this->email->initialize($config);
$this->email->to($this->data["userdata"]["email"]);
$this->email->from('support@website.com','Support');
$this->email->subject('Subject for the email');
$this->email->message($htmlContent);
$this->email->send();

Use the above code to send email in codeigniter. The email client will be codeigniter email client and can send message to any server without spamming.

send email in codeigniter, codeigniter email library. Send smtp email in codeigniter, send authenticated smtp email in codeigniter.

Leave a Reply

Your email address will not be published. Required fields are marked *