Kohana 3.3 and Koseven compatible email module using SwiftMailer or PHPMailer.
- Download to modules directory.
- Fetch dependencies:
composer install
- Include it in
APPPATH/bootstrap.php
modules list:
Kohana::modules(array(
...
'email' => MODPATH.'email',
...
));
- Include with composer:
composer require svenbw/kohana-email:dev-master
- Enable vendor autoload in
APPPATH/bootstrap.php
if not already:
require DOCROOT.'/vendor/autoload.php';
- In the same file include it in your modules list:
Kohana::modules(array(
...
'email' => DOCROOT.'/vendor/svenbw/kohana-email',
...
));
Send a message to a recipient
$mailer = Email::connect();
$mailer->send(
array('[email protected]', 'To recipient'),
array('[email protected]', 'The sender'),
'Test-email',
'<i>Test email</i>',
TRUE);
It is possible to create a message with chaining calls.
$mailer = Email::factory();
$mailer
->to('[email protected]', 'To recipient')
->from('[email protected]', 'The sender')
->subject('Test-email')
->html('<i>Test email body</i>')
->send();