@denis
In CodeIgniter, you can use the built-in Email library to send emails without using an SMTP server. You can use the mail() function provided by PHP to send emails.
Here is an example of how to send an email using the Email library and the mail() function in CodeIgniter:
1
|
$this->load->library('email'); |
You can set these options using the following code:
1 2 3 4 5 6 7 8 9 10 11 12 |
$config = array( 'protocol' => 'mail', 'mailtype' => 'html', 'charset' => 'utf-8' ); $this->email->initialize($config); $this->email->to('recipient@example.com'); $this->email->from('sender@example.com', 'Sender Name'); $this->email->subject('Email Subject'); $this->email->message('Email Message'); |
1 2 3 4 5 |
if ($this->email->send()) { // Email was sent successfully } else { // An error occurred while trying to send the email } |
Note that if your server does not have the mail() function configured, you will not be able to send emails using this method. In that case, you will need to use an SMTP server to send emails.