We do that very thingy by wrapping the standard, often repeated email
code in another component that uses the Email component,

Then you just have to do something along the lines of [in your
controller]:

var $component => array('Notify' => array('email config params'));

$this->Notify->send('all your email specific options here');






On Jul 2, 6:57 am, "Dave Maharaj :: WidePixels.com"
<[email protected]> wrote:
> Is there a easy way to set this up so it could be called from different
> controllers? Instead of putting that chunk repeated in different controllers
>
> So in a controller call the function anywhere
> $this->Model->Email->send($template , $subject)
>
> $this->Email->smtpOptions = array('port' => '26', 'timeout' => '30', 'host'
> => 'localhost', 'username' => '[email protected]', 'password' =>
> 'xxxxxx');
>                   /* Set delivery method */
>                   $this->Email->delivery = 'smtp';
>                   $this->Email->to = $this->data['User']['email'];
>                   $this->Email->subject = 'welcome message';
>                   $this->Email->replyTo = xxxxxxxxxxxx  ;
>                   $this->Email->from = 'me';
>                   $this->Email->sendAs = 'html';
>                   $this->Email->template = 'confirmation';
>                   $this->set('name', $this->data['User']['username']);
>                 $this->set('ip_address', $_SERVER['REMOTE_ADDR']);
>                   $this->set('server_name', $_SERVER['SERVER_NAME']);
>                   $this->set('slug', $this->data['User']['slug']);
>                   $this->set('code', $this->data['User']['confirm_code']);
>
> Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

  • email function Dave Maharaj :: WidePixels.com
    • Re: email function Paul Webster

Reply via email to