/** * @param \Application\Controller\AbstractActionController $controller */ public function sendNewActivityMail($controller, $lang_code = 'en-US') { // initial data for email template //$lang_code = $controller->params()->fromRoute('lang'); $projectLink = $controller->getBaseUrl() . '/' . $lang_code . '/admin/project/detail?id=' . $this->project->getId(); $data = array('project' => $this->project->getData(), 'type' => $this->type, 'sender' => $this->sender->getData(), 'message' => $this->message, 'projectLink' => $projectLink); $emails = []; $emails[] = $controller->getUser(array("staff" => $this->project->getData()['pm']['id']))->getData()['email']; $emails[] = $controller->getUser(array("employer" => $this->project->getData()['client']['id']))->getData()['email']; if ($this->project->getData()['sale']) { $emails[] = $controller->getUser(array("staff" => $this->project->getData()['sale']['id']))->getData()['email']; } // Uncomment to remove current user from mail list to send // $user = $controller->getCurrentUser(); // if(($key = array_search($user->getEmail(), $emails)) !== false) { // unset($emails[$key]); // } $tpl = "ACTIVITY_NEW"; switch ($this->type) { case 'accept_quote': case 'create_quote': case 'create_task': case 'message': } foreach ($emails as $email) { Mail::sendMail($controller, $tpl, $email, $data); } }
/** * @param \Application\Controller\AbstractActionController $controller */ public function sendForgotPasswordEmail($controller, $lang = 'en-US') { //$lang = 'en-US' // initial data for email template $forgotLink = $controller->getBaseUrl() . '/' . $lang . '/user/forgotPassword/reset?token=' . $this->token; $data = array('firstName' => $this->firstName, 'lastName' => $this->lastName, 'link' => $forgotLink); Mail::sendMail($controller, "USER_RESET", $this->email, $data); }