Thanks, I got it working!
Sharon
On Saturday, 19 May 2012 04:02:10 UTC+1, GB wrote:
>
> Recently I had similar problem. In one of my apps, this works:
> $email = new CakeEmail('smtp');
>
> In a second I had to separate out config setting:
> $email = new CakeEmail();
> $email->config('smtp');
>
> Don't ask me why the need for 2 as once it was working I moved on.
>
> George
>
>
> On Friday, May 18, 2012 7:08:51 AM UTC-4, WhyNotSmile wrote:
>>
>> I've been sending emails from my PagesController, and that has been
>> working fine, but now I need to send from AppController instead, and I
>> can't get the emails to send. As far as I can see, I have exactly the same
>> code in both, but the AppController function simply doesn't send the
>> email. There are no error messages or anything - I just don't get an email.
>>
>> I wondered if maybe it can't find the view file or something like that?
>> Can anyone advise me?
>>
>> Here is my code (in AppController):
>>
>> function sendSystemEmail($to = EMAIL_CONTACT, $from =
>>> array(EMAIL_FROM => SITE_NAME), $subject = null, $body = null, $view =
>>> null, $vars = null) {
>>> App::uses('CakeEmail', 'Network/Email');
>>> $email = new CakeEmail();
>>> $email->viewVars(array(
>>> 'body' => $body,
>>> 'vars' => $vars
>>> ));
>>> $email->template($view)
>>> ->emailFormat('html')
>>> ->from(EMAIL_FROM)
>>> ->to($to)
>>> ->subject($subject)
>>> ->send();
>>> return;
>>> }
>>>
>>
>> Thanks for any help you can give!
>>
>
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php