On Fri, Oct 9, 2009 at 1:02 AM, Bruno Bergher <bruno.berg...@gmail.com> wrote: > > Hi there, > > Summary: when using EmailComponent I bump into a strange problem in > the View class. Using CakePHP 1.3.0.0. > > I'm using EmailComponent in a very standard way. In my controller I > have: > > $this->Email->to = 's...@email.com'; > $this->Email->from = 'some.ot...@email.com'; > $this->Email->subject = 'Message Subject'; > $this->Email->template = 'template_name'; // under views/elements/ > email/text/template_name.ctp > $this->Email->sendAs = 'text' ; > $this->Email->send(); > > The template exists and is just plain text, no special characters. > > This leads to a blank page, regardless of the E_ALL error reporting > level. > > So I go down into the Email component class, adding die("here") calls > and find out it fails on line 461: > > $content = explode("\n", str_replace(array("\r\n", "\r"), "\n", $View- >>renderLayout($content))); > > > Now I go to $View->renderLayout() and add the same die("here") calls > there, and realize the problem is actually happening right before line > 747, which is odd, because it's just: > > return $out;
So renderLayout() is probably fine. If you add: die($View->renderLayout($content)); just before line 461 in the component, what do you get? Other things to check around that line: $content -- before the explode() call $View->layoutPath > The thing is that if I do debug($out) right before 747, it outputs the > message perfectly, but in the normal flow of the class, it just breaks > and returns me a blank screen after some 5 seconds hanging, with no > error neither on the screen or the logs. > > I tried everything and have absolutely no idea what to do from here. I > fiddled with all the parameters, renamed the template, changed it's > content, nothing works. It only works when I remove the $this->Email- >>template line and do like $this->Email->send('any text), but that's > no good, obviously. > > One more curious thing: if above view.php:498 I add > debug($data_for_layout); > it fails in the exact same way (the request hangs for some 5 seconds > and returns blank), but if I try > pr($data_for_layout); > it prints it's contents perfectly. Just thought this could be useful. That's likely just because debug has been set to 0 before that. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---