Hi I have one big problem which drives me crazy. My application is some kind of a database of graphics projects with data screens and comments. In "Show Projects details" view there is an ability to comment the graphic project. And after submitting the comment application sends an email to the author of the project. After that it should redirect to the "Show Projects details" view again but unfortunately there is a problem. The page goes blank. And if I press back on web browser and click refresh the comment shows up. I turn the debug 2 on and there are no errors. Furthermore there is a table with SQL data and above it a proper link where it should redirect. I have Notification component which uses core Email component. In this Notification component I have a method:
function send($subject = 'Message', $id, $template, $text = "", $mail = WEBSTUDIO_EMAIL, $private = false) { $this->Email->reset() $this->Email->delivery = 'smtp'; $this->Email->smtpOptions = array( 'port'=>'25', 'timeout'=>'30', 'host' => EMAIL_SMTP_HOST, 'username'=> EMAIL_SMTP_USER, 'password'=> EMAIL_SMTP_PASSWORD ); $this->Email->to = $mail; $this->Email->subject = '[Project '.$id.'] '.$subject; $this->Email->from = EMAIL_NAME.' <'.EMAIL_FROM.'>'; $this->Email->sendAs = 'text'; $this->Email->replyTo = WEBSTUDIO_EMAIL; $this->Email->template = $template; $this->controller->set('id', $id); $this->controller->set('text', $text); $this->controller->set('email', $this->obAuth->user["User"] ['email']); $this->controller->set('user', $this->obAuth->user["User"] ['username']); App::import('Model', 'User'); $User = &new User(); if (!$private) { $emails = $User->findAll('`User`.`id` IN (SELECT user_id FROM users_permissions WHERE user_id != '.$this->obAuth->user["User"] ['id'].' AND permission_id = '.$this->obAuth- >id('COMMENTS_INFO').')', array('DISTINCT `User`.`id`', '`User`.`email`', '`User`.`name`'), null, null, null, 0); foreach($emails as $email) { $this->Email->bcc[] = "{$email['User']['name']} <{$email['User']['email']}>"; } if ($mail != WEBSTUDIO_EMAIL) { $this->Email->bcc[] = WEBSTUDIO_EMAIL; } } if ($this->Email->send()) { $this->Session->setFlash('Wysłano wiadomość.'); $debug = $this->Session->read('Message.email'); $this->controller->log("\n\n*Wysłano wiadomość* \n \n{$debug['message']}", 'email.' . date('Y-m-d')); return true; } else { $this->Session->setFlash('Wystąpił błąd podczas wysyłania wiadomości'); $debug = $this->Session->read('Message.email'); $this->controller->log("\n\n*Nie wysłano wiadomości ".$this->Email- >smtpError, "\n{$debug['message']}", 'email.' . date('Y-m-d')); @mail(ADMIN_EMAIL, env('SERVER_NAME').' Error: email', "Temat: ". $this->Email->subject."\n\nBłąd: ".$this->Email->smtpError); } return false; Usage of this component in my Templates Controller is: $this->Notification->send('Comment', $this->data['Comment'] ['template_id'], 'comment', $orig_comment, $this->data['Comment'] ['author_email']); where as you can see 'comment' is a template of the mail. The content of comment.ctp is: <?=i18n('User %s adds a comment', $user) ?> ====================================================================== <?=i18n('See the details of the project here:') ?>: http://th.netart.pl/templates/view/<?=$id ?>, ====================================================================== <?=i18n('Content of the comment') ?>: <?=$text; ?> I narrowed the problem to this line in the Notification component: $this->Email->template = $template; When I commented it, the redirect method worked properly but the mail was empty. I know that in this situation application has no email template assigned. But even if went back to the previous state and try to erase the content of the comment.ctp nothing has changed. There were no Warning: Cannot modify header information - headers already sent, just the blank page. I do not know why there is a problem with this email template and I have just spent 10 hours to solve this and I didn't find the solution to this. Please help me. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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