PHPMailer in CodeIgniter

In a previous post I talked about how to use the library PHPMailer to send emails from our website without having our own mail server running on the machine. This time we will go a step further and explain how to integrate this library in our CodeIgniter project and not die in the attempt.

The first thing we do, if we have not done it yet, will be to download the library. Once we unzip the library, we can rename the folder named PHPMailer and move it to the folder /system/application/libraries (for CodeIgniter 1.7.3 or previous) or to the folder /application/libraries/ (for CodeIgniter 2.0 or later) in our CodeIgniter application. Once we did it so, we can start to implement our own library, which will be in charge of including PHPMailer into our application. To do this we have to create a new PHP file in the CodeIgniter’s library directory called my_phpmailer.php. In this file we will write the following code:
[…]

PHPMailer: Send emails from your site

This time I would like to talk about the library PHPMailer. This library is ideal if you need to send emails from your web site to its users (e.g: for notifying the data suscription, warning about the near account expiration, etc). A very interesting feature offered by this library is allowing us using a GMail account to send emails (of course, we must be the owners of that account). […]