Example #1
0
 /**
  * Merge and send an email message with the content of
  * an executed sqlQuery .
  *
  *  @param sqlConnect $query executed sqlQuery
  *  @see getField()
  */
 function fusion($query)
 {
     $numsent = 0;
     set_time_limit(3600);
     while ($row = $query->fetchArray()) {
         $numsent++;
         $fields = $this->getField($this->mBody);
         $fields = $this->getField($this->mBodyHtml);
         $SendBody = $this->mBody;
         $SendBodyHtml = $this->mBodyHtml;
         $SendSubject = $this->mSubject;
         if (is_array($fields)) {
             foreach ($fields as $field) {
                 $SendBody = eregi_replace("\\[{$field}\\]", $row[$field], $SendBody);
                 $SendBodyHtml = eregi_replace("\\[{$field}\\]", $row[$field], $SendBodyHtml);
                 $SendSubject = eregi_replace("\\[{$field}\\]", $row[$field], $SendSubject);
             }
         }
         $SendBody = ereg_replace("\r", "", $SendBody);
         $this->setHeader();
         if (strlen($SendBodyHtml) > 5) {
             $this->sendMailHtml($row[$this->cfgEmailField], $SendSubject, $SendBody, $SendBodyHtml, $this->header);
         } elseif (strlen($this->file) > 0 && strlen($this->filename) > 0) {
             $this->sendMailJoin($row[$this->cfgEmailField], $SendSubject, $SendBody, $this->file, $this->filename, $this->header);
         } else {
             $this->sendMailStandard($row[$this->cfgEmailField], $SendSubject, $SendBody, $this->header);
         }
         //if (is_integer($numsent/10)) { echo ".";}
         //if (is_integer($numsent/100)) {echo $numsent." <br>\n"; }
     }
     return $numsent;
 }