svenbw/kohana-email

Email module for Koseven

dev-master 2018-08-25 07:27 UTC

This package is not auto-updated.

Last update: 2024-04-28 03:25:32 UTC


README

Kohana 3.3 and Koseven compatible email module using SwiftMailer or PHPMailer.

How to install

Direct download method

  1. Download to modules directory.
  2. Fetch dependencies:
composer install
  1. Include it in APPPATH/bootstrap.php modules list:
Kohana::modules(array(
	...
	'email' => MODPATH.'email',
	...
));

Composer module method

  1. Include with composer:
composer require svenbw/kohana-email:dev-master
  1. Enable vendor autoload in APPPATH/bootstrap.php if not already:
require DOCROOT.'/vendor/autoload.php';
  1. In the same file include it in your modules list:
Kohana::modules(array(
	...
	'email' => DOCROOT.'/vendor/svenbw/kohana-email',
	...
));

Usage

Send a message to a recipient

$mailer = Email::connect();
$mailer->send(
    array('to-recipient@example.com', 'To recipient'),
    array('the-sender@example.com', 'The sender'),
    'Test-email',
    '<i>Test email</i>',
    TRUE);

Advanced usage

It is possible to create a message with chaining calls.

$mailer = Email::factory();
$mailer
  ->to('to-recipient@example.com', 'To recipient')
  ->from('the-sender@example.com', 'The sender')
  ->subject('Test-email')
  ->html('<i>Test email body</i>')
  ->send();