Oriol Mercadé wrote:
> Hi lukas,
> try this. function
>
> public static function sendEmail($infos,$emailTemplate){
> $myContext = sfContext::getInstance();
> $myUser = sfContext::getInstance()->getUser();
>
> foreach ($infos as $info){
> $myUser->setAttribute($info[0], $info[1], 'symfony/flash');
> }
>
> sfContext::getInstance()->getController()->getPresentationFor('mail',
> $emailTemplate, 'sfMail');
>
> }
>
> i coded it to send emails from batch, bear in mind that $infos is an
> array of variables that will be converted into flash variables and will
> have to be catched in the action of the email action. For example, if
> you want to send "hello $username!"
>
> you will use:
>
> classYouPutStaticmethod::sendEmail(array("username"=>$user()->getUsername(),
> "email"=>$user->getEmail()),"templateEmailSayingHello");
thx .. actually you can set request attributes. that works just fine.
however getPresentationFor() seems to call sendHttpHeaders(), which
means that you cannot output anything in your shell script before that
call, which makes debugging very painful. I guess I need to hunt for a
setting to disable sending of headers when running inside the shell.
regards,
Lukas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---