Send mail through an SMTP server in CodeIgniter
Snippet·
$this->load->library('email', array(
'protocol' => 'smtp',
'smtp_host' => 'mail.example.com',
'smtp_user' => '[email protected]',
'smtp_pass' => $password,
'smtp_port' => 587,
));
$this->email->from('[email protected]', 'Orders');
$this->email->to($order->email);
$this->email->subject('Order 10428 confirmed');
$this->email->message($body);
if (! $this->email->send()) {
log_message('error', $this->email->print_debugger());
}