PHPackages                             adrianorsouza/codeigniter-phpmailer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. adrianorsouza/codeigniter-phpmailer

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

adrianorsouza/codeigniter-phpmailer
===================================

CodeIgniter Mail Plugin Powered by PHPMailer Library

v0.1.5(7y ago)102.3k13[1 issues](https://github.com/adrianorsouza/codeigniter-phpmailer/issues)MITPHPPHP &gt;=5.2.4

Since Apr 27Pushed 6y ago3 watchersCompare

[ Source](https://github.com/adrianorsouza/codeigniter-phpmailer)[ Packagist](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer)[ Docs](https://github.com/adrianorsouza/codeigniter-phpmailer)[ RSS](/packages/adrianorsouza-codeigniter-phpmailer/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Codeigniter mail plugin powered by PHPMailer
============================================

[](#codeigniter-mail-plugin-powered-by-phpmailer)

### A simple CodeIgniter mail class to connect your application through the powerful PHPMailer library.

[](#a-simple-codeigniter-mail-class-to-connect-your-application-through-the-powerful-phpmailer-library)

[![Latest Stable Version](https://camo.githubusercontent.com/1f3f87418866e34ed915c3c5f321bc128df33b706b6d4f8c38ff509fc968df7d/68747470733a2f2f706f7365722e707567782e6f72672f61647269616e6f72736f757a612f636f646569676e697465722d7068706d61696c65722f762f737461626c652e737667)](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer) [![Total Downloads](https://camo.githubusercontent.com/43257ccb24812a9ce34e7189cd9e07a8b10aeb18a8fb9ae33eee1e1a9e5fac13/68747470733a2f2f706f7365722e707567782e6f72672f61647269616e6f72736f757a612f636f646569676e697465722d7068706d61696c65722f646f776e6c6f6164732e737667)](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer) [![Latest Unstable Version](https://camo.githubusercontent.com/3d180547feae683acc95b4f9758228e2626bd72959a058704ed66eadc3310cd4/68747470733a2f2f706f7365722e707567782e6f72672f61647269616e6f72736f757a612f636f646569676e697465722d7068706d61696c65722f762f756e737461626c652e737667)](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer) [![License](https://camo.githubusercontent.com/7b91f206a0da325c76f066a1d7b516d98c6f6a9ca5f1af3c3e5957f85c28dfcd/68747470733a2f2f706f7365722e707567782e6f72672f61647269616e6f72736f757a612f636f646569676e697465722d7068706d61696c65722f6c6963656e73652e737667)](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer)

Tested over CodeIgniter v2.1.4 / v3.0-dev and PHPMailer Version 5.2.7

Install via Composer
--------------------

[](#install-via-composer)

### To get this plugin via composer is the quick start.

[](#to-get-this-plugin-via-composer-is-the-quick-start)

This plugin utilizes Composer for its installation and PHPMailer dependency. If you haven't already, start by installing [Composer](http://getcomposer.org/doc/00-intro.md).

And are available via [Composer/Packagist](https://packagist.org/packages/adrianorsouza/codeigniter-phpmailer). Once you have Composer configured in your environment run the command line:

```
  $ composer require "adrianorsouza/codeigniter-phpmailer:0.1.*"

```

This command will write into composer.json beyond download and place this project files and PHPMailer dependencies into your `vendor` folder.

If you have not included the composer autoload you must do it at the very top of your index.php page or whatever you are running this plugin.

```
require_once __DIR__.'/vendor/autoload.php';
```

that's all. Your able to send e-mail anywhere inside your CodeIgniter application.

To create an instance of `Mail()` class:

```
 $mail = new Mail();
```

Alternatively manual installation
---------------------------------

[](#alternatively-manual-installation)

If you don't speak Composer, follow this instructions:

- Download this zip files and uncompress it within of your `application/` directory.
- Download [PHPMailer files](https://github.com/Synchro/PHPMailer) dependencies *because is not include in this package*.

    - PHPMailerAutoload.php
    - class.smtp.php
    - class.phpmailer.php

place them into your `third_party` folder or `what/you/want` as long as you include PHPMailer autoloader where you call the class `Mail()`.

To load class `Mail()` use the same Codeigniter super-object:

```
$this->load->library('mail');
```

That's all.

Configuration
-------------

[](#configuration)

After get this plugin you have to setup `mail_config.php` file that contains all mail server configuration that must be placed in your `application/config/` folder.

In order to be able to send emails from your local development either production server you must provide a valid SMTP account authentication.

So in this config file, you setup your smtp server and password, login, mail from and etc...

To set up a Gmail smtp account to send your emails, you must set the config `mail_smtp_secure` to `TLS`.

To send any message with a HTML template file place it into your views folder. The default folder is `views/templates/email` if you want to change it, set this in `mail_config.php` as long as it remains under views folder.

### Sample mail\_config.php

[](#sample-mail_configphp)

```
