Skip to content

Instantly share code, notes, and snippets.

@tsmsogn
Last active August 29, 2015 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsmsogn/cee9cef2e851e7684021 to your computer and use it in GitHub Desktop.
Save tsmsogn/cee9cef2e851e7684021 to your computer and use it in GitHub Desktop.
[cakephp]Using Email from Shell
<?php echo $a; ?>
<?php
App::uses('CakeEmail','Network/Email');
class FooShell extends AppShell {
public function main() {
$Email = new CakeEmail();
$Email->config(array(
'to' => array('foo@bar.baz'),
'from' => 'foo@bar.baz',
'subject' => __('subject'),
'template' => 'foo'
));
// Set variables to template
$Email->viewVars(array('a' => 1));
// Send email
$Email->send();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment