/**
  * the main method, execute the code of the class;
  * @access public
  */
 function Execute()
 {
     if (is_object($this->error)) {
         return $this->error;
     }
     if ($this->contentFile != '' && file_exists($this->contentFile) && ($fp = fopen($this->contentFile, 'r'))) {
         $this->content = fread($fp, filesize($this->contentFile));
         fclose($fp);
     } else {
         if ($this->contentFile != '') {
             return new tNG_error('EMAIL_NO_TEMPLATE', array(), array());
         }
     }
     $arrErrors = array();
     while (!$this->recordset->EOF) {
         $GLOBALS["row_" . $this->recordsetName] = $this->recordset->fields;
         $email = new KT_Email();
         $email->setPriority($this->importance);
         foreach ($this->attachments as $filename) {
             $email->addAttachment($filename);
         }
         $email->sendEmail($GLOBALS['tNG_email_host'], $GLOBALS['tNG_email_port'], $GLOBALS['tNG_email_user'], $GLOBALS['tNG_email_password'], $this->getFrom(), $this->getTo(), $this->getCc(), $this->getBcc(), $this->getSubject(), $this->getEncoding(), $this->getTextBody(), $this->getHtmlBody());
         if ($email->hasError()) {
             $arr = $email->getError();
             $arrErrors[] = 'Email to user: <strong>' . $this->getTo() . '</strong> was not sent. Error returned: ' . $arr[1];
         }
         $this->recordset->MoveNext();
     }
     if (count($arrErrors) > 0) {
         return new tNG_error('EMAIL_FAILED', array(''), array(implode('<br />', $arrErrors)));
     }
 }
Example #2
0
 /**
  * the main method, execute the code of the class;
  * @access public
  */
 function Execute()
 {
     if (is_object($this->error)) {
         return $this->error;
     }
     if ($this->contentFile != '' && file_exists($this->contentFile) && ($fp = fopen($this->contentFile, 'r'))) {
         $this->content = fread($fp, filesize($this->contentFile));
         fclose($fp);
     } else {
         if ($this->contentFile != '') {
             return new tNG_error('EMAIL_NO_TEMPLATE', array(), array());
         }
     }
     $email = new KT_Email();
     $email->setPriority($this->importance);
     foreach ($this->attachments as $filename) {
         $email->addAttachment($filename);
     }
     $email->sendEmail($GLOBALS['tNG_email_host'], $GLOBALS['tNG_email_port'], $GLOBALS['tNG_email_user'], $GLOBALS['tNG_email_password'], $this->getFrom(), $this->getTo(), $this->getCc(), $this->getBcc(), $this->getSubject(), $this->getEncoding(), $this->getTextBody(), $this->getHtmlBody());
     if ($email->hasError()) {
         $arr = $email->getError();
         return new tNG_error('EMAIL_FAILED', array(''), array($arr[1]));
     }
 }
 /**
  * the main method, execute the code of the class;
  * @access public
  */
 function Execute()
 {
     $this->searchCss();
     if ($this->encoding == '') {
         $this->encoding = 'iso-8859-1';
     }
     $email = new KT_Email();
     $email->setPriority($this->importance);
     foreach ($this->attachments as $filename) {
         $email->addAttachment($filename);
     }
     $email->sendEmail($GLOBALS['tNG_email_host'], $GLOBALS['tNG_email_port'], $GLOBALS['tNG_email_user'], $GLOBALS['tNG_email_password'], $this->getFrom(), $this->getTo(), $this->getCc(), $this->getBcc(), $this->getSubject(), $this->getEncoding(), $this->getTextBody(), $this->getHtmlBody());
     if ($email->hasError()) {
         $arr = $email->getError();
         return new tNG_error('EMAIL_FAILED', array(''), array($arr[1]));
     }
 }