Sending Emails with CodeIgniter
To send an email (say from a Gmail) through CodeIgniter, you first need to create a file in the application/config/ called email.php.
In the picture below, the first line makes sure that this file cannot be accessed by anybody else.
Then, in your controller, you will want this code (pretty self-explanatory imho):
One thing I will mention is that instead of doing the $this->load->library(‘email’) you could autoload that by modifying the autoload.php in the config folder.
Also, for the line $path = $this->config->item('server_root’) that may be able to be replaced with using the base_url() instead, but I haven’t tested it. So no promises.