Skip to contentSkip to navigationSkip to topbar
Rate this page:

CodeIgniter


CodeIgniter comes with an email sending library built in. See more information on how to use CodeIgniter with SendGrid(link takes you to an external page).

(information)

Info

It is important to use the correct end of lines using "crlf" => "\r\n" and "newline" => "\r\n".


_23
<?php
_23
$this->load->library('email');
_23
_23
$this->email->initialize(array(
_23
'protocol' => 'smtp',
_23
'smtp_host' => 'smtp.sendgrid.net',
_23
'smtp_user' => 'apikey',
_23
'smtp_pass' => 'sendgridapikey',
_23
'smtp_port' => 587,
_23
'crlf' => "\r\n",
_23
'newline' => "\r\n"
_23
));
_23
_23
$this->email->from('your@example.com', 'Your Name');
_23
$this->email->to('someoneexampexample@example.com');
_23
$this->email->cc('another@another-example.com');
_23
$this->email->bcc('them@their-example.com');
_23
$this->email->subject('Email Test');
_23
$this->email->message('Testing the email class.');
_23
$this->email->send();
_23
_23
echo $this->email->print_debugger();
_23
?>


Rate this page: