Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

KO3 E-mail Module

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 classes
Octocat-spinner-32 config
Octocat-spinner-32 vendor
Octocat-spinner-32 views
Octocat-spinner-32 README
Basic Usage:

1. Customize the congfiguration setting in /config/mailer.php
	return array
		'production' => array(
			'transport'	=> 'smtp',
			'options'	=> array
								'hostname'	=> '',
								'username'	=> '',
								'password'	=> 'password',
								'encryption'=> 'ssl',
								'port'		=> '465',
		'development' => array(
			'transport'	=> 'smtp'

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 before()
			// To set the config by environment
			$this->config		= Kohana::$environment;

		public function welcome($args) 
			$this->to 			= array('' => 'Tom');
			$this->bcc			= array('' => 'Admin');
			$this->from 		= array('' => 'The Team');
			$this->subject		= 'Welcome!';
			$this->attachments	= array('/path/to/file/file.txt', '/path/to/file/file2.txt');
			$this->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() 
		$data = array(
			'user' => array(
				'name' => 'Tom'

		//you can also pass arguments to the mailer
		//you can also use instance
		//you can also pass arguments in factory
		Mailer::factory('user', 'welcome', $data);
		//you can also send direct from the controller

Something went wrong with that request. Please try again.