Мой CakePHP должен отправлять электронное письмо при нажатии кнопки, но это не так.Кроме того, сообщение электронной почты будет отображаться в виде флеш-сообщения, если я запускаю его в режиме отладки: ($this->Email->delivery = 'debug';
).
Примечание. Адрес электронной почты настроен на использование функции mail mail () PHP.
Код для вызова функции электронной почты:
$this->_sendUpdateEmail( $this->Auth->user('id'), $about_id );
Функция электронной почты
function _sendUpdateEmail($from_user_id, $about_id) {
$fromUser = $this->User->read(null, $from_user_id);
$users = $this->User->find('all', array(
'conditions' => array('User.distribution =' => 1)
));
# loop to send email to all users who are marked as on the distribution list
for($i = 0, $size = sizeof($users); $i < $size; ++$i) {
$user = $users[$i]['User'];
$this->Email->from = $fromUser['User']['email'];
$this->Email->replyTo = $fromUser['User']['email'];
$this->Email->to = $user['email'];
$this->Email->subject = 'Test email';
$this->Email->template = 'update';
$this->Email->sendAs = 'both'; // both = html and text
$this->set('user', $user);
$this->set('about', $about_id);
$this->Email->send();
$this->Email->reset();
}
}
Есть идеи, почему сообщения электронной почты отображаются в режиме отладки, но на самом деле не отправляются?