Skip to content

Instantly share code, notes, and snippets.

@WinterSilence
Last active September 5, 2020 09:54
Show Gist options
  • Save WinterSilence/9782250 to your computer and use it in GitHub Desktop.
Save WinterSilence/9782250 to your computer and use it in GitHub Desktop.
Example Kohana CLI Task
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* Example...
*
* @package Kohana/CLI
* @category Task
* @author Kohana Team
* @copyright (c) 2013-2014 Kohana Team
* @license http://kohanaframework.org/license
*/
class CLI_Task_Mailer extends CLI_Task {
/**
* Send mails.
*
* @return void
*/
protected function action()
{
$mail = Mail::factory('...')->subject('...')->body('...')->from('..');
$users = ORM::factory('User')->find_all();
foreach ($users as $user)
{
$mail->to($user->email)->send();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment