private function contact() { $sent = false; $success = 'Thank you. You are very important to us, '; $success .= 'all information received will always remain confidential. '; $success .= 'We will contact you as soon as we review your message.'; $error = 'The message could not be sended. Please, try again.'; if ($this->request->is('post')) { if (!empty($_POST["email"]) && !empty($_POST['content'])) { $email = new Email('default'); $email->to('*****@*****.**')->subject(__('Feedback Form'))->send($_POST['content']); $this->Flash->success($success); $sent = true; } else { $this->Flash->error($error); } } $this->set('sent', $sent); }
/** * Notifies user their password has changed. * @param $id * @return */ private function sendPasswordChangedEmail($id = null) { if (!empty($id)) { $user = $this->Users->get($id, ['contain' => []]); $email = new Email(); $email->template('password_reset_success')->emailFormat('html')->to($user->email)->from(__('*****@*****.**'))->subject(__('Password Reset success - DO NOT REPLY'))->set('user', $user)->send(); return true; } return false; }