Example #1
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;
 }