Example #1
0
 public function run()
 {
     // echo "sign up model";
     $user = $this->propareVO();
     // if Email not exists, continue to create
     if (!UserDAOImpl::findByEmail($user->getEmail())) {
         $result = UserDAOImpl::doCreate($user);
         // create user in db
         if ($result) {
             // send mail
             $iEmailService = new EmailService();
             $iEmailService->setReceiver($user);
             $msg = $iEmailService->sendEmail();
             // header('location: ../login');
         } else {
             $msg = SQL_EXCEPTION_CREATE_USER;
             // show error prompt
         }
     } else {
         $msg = SIGN_UP_DUPLICATE_REGISTER;
     }
     $controller = new Prompt();
     $controller->index($msg);
 }
 function sendInvoiceEmail($hotel, $email, $status)
 {
     $mode = 1;
     //html
     $ret = true;
     if ($status == 0) {
         //JMail::sendMail($from, $fromname, $recipient, $subject, $body, $mode=0, $cc=null, $bcc=null, $attachment=null, $replyto=null, $replytoname=null)
         $ret = EmailService::sendEmail($email->company_email, $email->company_name, $email->company_email, $hotel->email, null, null, $email->subject, $email->content, $mode);
     } else {
         $appSettings = JHotelUtil::getApplicationSettings();
         $emailAddress = '';
         if ($appSettings->send_invoice_to_email) {
             $emailAddress = $appSettings->invoice_email;
         } else {
             $emailAddress = $hotel->email;
         }
         //JMail::sendMail($from, $fromname, $recipient, $subject, $body, $mode=0, $cc=null, $bcc=null, $attachment=null, $replyto=null, $replytoname=null)
         $ret = EmailService::sendEmail($email->company_email, $email->company_name, $email->company_email, $emailAddress, null, null, $email->subject, $email->content, $mode);
     }
     return $ret;
 }
Example #3
0
 /**
  * Send email using the report account. Report account credentials 
  * must be configured in application.ini or enviroment in order
  * function. 
  * 
  * @param string $subject		Email subject text
  * @param array $to			Array of recipients' email addresses 
  * @param string $textbody	Text representation of email body
  * @param string $htmlbody	Html representation of email body
  * @param string $replyto		Recipient's email address which replyto fucntion will point to.
  * @param array $attachment	Attachement array as provided from the EmailService::createAttachment function
  * @param array $cc			Array of recipient email addresses where the email carbon copied 
  * @param array $ext			Array of key/value pairs for the email header.Eg Precedence=bulk
  * @return boolean
  */
 public static function sendReport($subject, $to, $textbody = '', $htmlbody = '', $replyto = false, $attachment = null, $cc = false, $ext = null)
 {
     $credentials = self::getReportCredentials();
     if ($credentials === FALSE) {
         EmailService::log('No credentials registered for report email account', 'ERROR');
         return false;
     }
     if ($attachment !== NULL && !is_array($attachment)) {
         $attachment = EmailService::createAttachment($attachment);
     }
     EmailService::sendEmail($subject, $to, $textbody, $htmlbody, $credentials['username'], $credentials['password'], $replyto, $attachment, $cc, $ext);
     return true;
 }
 /**
  * Sends an email to reviewer when a Performance Review is added.
  *
  * @param PerformanceReviewService $review
  * @return null
  */
 public function informReviewer(PerformanceReview $review)
 {
     try {
         $reviewerEmail = $review->getReviewer()->getEmpWorkEmail();
         if ($reviewerEmail != '') {
             $content = file_get_contents(sfConfig::get('sf_root_dir') . "/apps/orangehrm/modules/performance/templates/email/" . self::EMAIL_TEMPLATE_ADD_REVIEW);
             $varibles = array('#reviewerName' => $review->getReviewer()->getFirstName(), '#empName' => $review->getEmployee()->getFullName(), '#period' => set_datepicker_date_format($review->getPeriodFrom()) . ' ' . set_datepicker_date_format($review->getPeriodTo()), '#dueDate' => set_datepicker_date_format($review->getDueDate()));
             $mailBody = strtr($content, $varibles);
             $mailService = new EmailService();
             $mailService->setMessageTo(array($reviewerEmail));
             $mailService->setMessageFrom(array("admin@orangehrm"));
             $mailService->setMessageSubject("You Have Been Assigned a New Performance Review");
             $mailService->setMessageBody($mailBody);
             @$mailService->sendEmail();
         }
         return true;
     } catch (Exception $e) {
         throw new PerformanceServiceException($e->getMessage());
     }
 }