PHPMailer driver for kohana
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
classes Some fixes with config_load Mar 17, 2016
config Add config Dec 1, 2015
vendor Edit readme Dec 1, 2015
.gitmodules Add submodule Dec 1, 2015 Restructire new options, edit README Feb 15, 2016
init.php Copy files Dec 1, 2015

Kohana Email module

Factory-based email class. This class is a simple wrapper around PHPMailer.

How to install

clone with --recursive option

Put all files into modules/email directory and enable module in bootstrap.php:

	'email' => MODPATH.'email',

Then copy MODPATH/email/config/email.php to APPPATH/config/email.php. Well done!


Simple use case::

$email_subject = 'Hi there!';
$email_body = 'Hi, guys! This is my awesome email.';
$is_html = false;
$message = Email::factory($email_subject, $email_body, $is_html)
	->to('', 'Mr. Recipient', 'CC')
		''=>'Mr. Recipient',
		''=>'Mr. Recipient'
$result = $message->send();
if($result) Session::instance()->set('message','Email sent successfully');

or like this

$email_body = '<p>This is <em>my</em> body, it is <strong>nice</strong>.</p>';
$message = Email::factory('Hi there!', $email_body, true);

Additional senders can be added using the from() and reply_to() methods. If multiple sender addresses are specified, you need to set the actual sender of the message using the sender() method. Set the bounce recipient by using the return_path() method.

To access and modify the PHPMailer message directly, use the mailer() method.

For advanced using, read classes/Kohana/Email.php - class is self-documented


return array(
	'driver' => 'native', // native, sendmail, smtp
	 * Driver options:
	 * @param   null    native: no options
	 * @param   string  sendmail: executable path, with -bs or equivalent attached
	 * @param   array   smtp: hostname, (username), (password), (port), (encryption), (debug) 0-4 ,function($str, $level)(debug_output)
	'options' => array(),
	'from' => array('','Example noreply mailer'),
	'charset' => 'UTF-8' // charset

Configuration is stored in config/email.php by default. Options are dependant upon transport method used. Consult PHPMailer documentation for options available to each transport.