Hi,

I am just running into the same problem. Have you found a solution yet?
I want to send an email via a shell script and have trouble passing teh body to 
the Email component when using the mail functions from the example shell script 
"my". I will now try your solution.

Anja

-----Ursprüngliche Nachricht-----
Von: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] Im Auftrag 
von goncalo.marr...@gmail.com
Gesendet: Mittwoch, 21. Januar 2009 13:20
An: CakePHP
Betreff: Sending emails in console scripts


Hi.

I'm writing a console shell that needs to send emails. I want to use the 
EmailComponent but the only way i've managed to get it to work is to manually 
create an instance of AppController an pass it to a manually created instance 
of EmailComponent.

My code:

App::import('Core', 'Controller');
App::import('Controller', 'AppController'); $AppController = new 
AppController(); $AppController->constructClasses();

App::import('Component', 'Email');
$Email = new EmailComponent();
$Email->initialize($AppController);
$Email->startup($AppController);

Is there a simpler/more elegant way of achieving this? Shouldn't Shell have a 
$components variable the same way it has a $uses variable?

Thanks in advance.

Gonçalo Marrafa


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to