Kohana 3.3 email module using SwiftMailer or PHPMailer
Before using the email module, we must enable it first on APPPATH/bootstrap.php
:
Kohana::modules(array(
...
'email' => MODPATH.'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();