Send an Email in Kohana

Posted . Visible to the public.

Send an email in Kohana using the built in email class(module). In this case we are using a html email view and passing in a variable and then passing it over to the email handler.

$view = View::factory('/path/to/view');
$view->vars = "If you want to pass variables to your view";

$email = Email::factory()
   ->subject("Email Subject")
   ->to('to@email.com')
   ->from('no-reply@email.com', "Sender Name")
   ->message($view, 'text/html')
   ->send();
Matt Tew
Last edit
Tags
Posted by Matt Tew to Matt Tew's deck (2012-07-02 18:21)