Basic Usage:

1. Customize the congfiguration setting in /config/mailer.php

return array
(
	'transport'	=> 'smtp',
	'options'	=> array
					(
						'hostname'	=> 'thewebapp.com',
						'username'	=> 'mailer@thewebapp.com',
						'password'	=> 'p@ssw0rd',
						'port'		=> '25',
					),
);


2. Create a class that extends the Mailer class and save it to /classes/mailer/class_name.php (Minus the Mailer_)


<?php defined('SYSPATH') or die('No direct script access.');

class Mailer_User extends Mailer {

	public function welcome($args) 
	{
		$this->to 			= array('tom@example.com' => 'Tom');
		$this->bcc			= array('admin@theweapp.com' => 'Admin');
		$this->from 		= array('theteam@theweapp.com' => 'The Team');
		$this->subject		= 'Welcome!';
		$this->attachments	= array('/path/to/file/file.txt', '/path/to/file/file2.txt');
		$this->body_data 	= array('user' => array('name' => 'Tom')); //$this->body_data = $args;
	}

}


3. Create the view for the email and save it to /views/mailer/class_name/method_name.php (Minus the Mailer_)


<p>Welcome <?= $user['name']; ?>,</p>

<p>We are glad you signed up for our web app.  Hope you enjoy.</p>

<p>The Team</p>



4. Use the Mailer_User class in one of your controllers

public function action_submit() 
{
	Mailer::factory('user')->send_welcome();
	
	//you can also pass arguments to the mailer
	Mailer::factory('user')->send_welcome(array('user' => array('name' => 'Tom')));
}

