Using a class inside of a class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Can I use another class inside of a function in a class


this function process_queue below is inside of a class called class mailer
I want to use the phpMailer class inside of this function so I can send email using smtp.
Can this be done and is there any information out there on how to do this


function process_queue($num=10){

if (isset($this->db_settings['demo']) and ($this->db_settings['demo'])){
           return;
       }

$q = $this->ams->db->query("SELECT * FROM {$this->ams->pre}email_queue WHERE queue_state = 0 ORDER BY queue_time_added ASC LIMIT $num");

       while ($row = $this->ams->db->nqfetch($q)){

           $this->to = $row['queue_to'];
           $this->headers = $row['queue_headers'];
           $this->subject = $row['queue_subject'];
           $this->message = $row['queue_text'];

$updateq = $this->ams->db->query("UPDATE {$this->ams->pre}email_queue SET
                           queue_time_added = queue_time_added,
                           queue_time_sent = NOW(),
queue_state = -2 WHERE queue_id = {$row['queue_id']}");

if (@mail($this->to, $this->subject, $this->message, $this->headers)){
               $result = 1;
           }
           else{
               $result = -1;
           }

           if ($this->ams->settings['email_debug']){
@mail ($this->ams->settings['site_email'], $this->subject, $this->message, $this->headers);
           }

$updateq = $this->ams->db->query("UPDATE {$this->ams->pre}email_queue SET
                           queue_time_added = queue_time_added,
                           queue_time_sent = NOW(),
queue_state = $result WHERE queue_id = {$row['queue_id']}");
       }
   }

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux