/** * send mail to client * @param Object $sf_guard_user * @param Object $message * @param Object $client_profile */ private function sendMailToClient($sf_guard_user, $message, $client_profile) { $profile = $this->getUser()->getGuardUser()->getProfile(); $set_action = 'Send mail to client'; $client_full_name = $client_profile->getFname() . ' ' . $client_profile->getLname(); $client_mail = $client_profile->getEmail(); $tools = new myTools(); // if user tick checkbox to send the mail if ($client_mail && $tools->isValidEmail($client_mail)) { $category = $message->getCategory(); $msgs_category = new Messages(); $category_change_to_title = $msgs_category->messageCategory($category); sfConfig::set('sf_web_debug', false); $content = get_partial('mail_data', array('profile' => $profile)); $change_to = str_replace('changeto', "{$client_full_name}", $content); $change_from = str_replace('changefrom', $sf_guard_user->getProfile()->getFullname(), $change_to); $change_subject = str_replace('changesbjct', $message->getSubject(), $change_from); $change_cat = str_replace('changecat', $category_change_to_title, $change_subject); $change_body = str_replace('changebody', $message->getBody(), $change_cat); $mailBody = $change_body; // send mail to client $mailclass_obj = new mailSend(); $mailclass_obj->sendMailToUser($mailBody, $client_mail, $set_action); } }