Re: Re: Mail_Queue problem

From: Date: Fri, 28 May 2004 18:06:35 +0000
Subject: Re: Re: Mail_Queue problem
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12776@lists.php.net to get a copy of this message
Thanks Lorenzo, That helped. However, now it seems that everytime I run the script it sends out exactly half of the mail in the mail_queue rather than the whole thing. Is this by design? Any way to get around this and send out the whole queue at one time? Thanks again. Tyrone "Lorenzo Alberton" <l.alberton@quipo.it> wrote in message news:2004528194221.606347@the-simpsons... On Thu, 27 May 2004 16:13:39 -0700, Tyrone Cheung wrote: > I am a new user of PEAR and I love the concept of the Mail_Queue > for mailing out our newsletters to thousands of subscribers. I > have gotten to the point where everything seems to be installed > properly. When I ran a "$mail_queue->sendMailsInQueue();" call in > my script to send out all mails in the queue, it worked for a > while, and then hung. What do you mean with "hung"? The idea is you send a chunk of mails at each run. Obviously, you need to set a cron job at regular intervals to process the whole queue. For instance, if you have 100 emails and you send 10 email each time, you have to set 10 cron jobs... On Fri, 28 May 2004 10:17:54 -0700, Tyrone wrote: > Ok, I tried something else but I still need help here. Here is the > code that I'm using, straight from the mail_queue examples. > > ---------------- start code --------------------------------------- > $mail_queue =& new Mail_Queue($db_options, $mail_options); > $mail_queue->setBufferSize(5000); > while ($mail = $mail_queue->get()) { > $result = $mail_queue->sendMail($mail); > } > --------------- end code ----------------------------------------- > > This sends out mail from my mail queue, but it doesn't delete them > from the queue, unlike $mail_queue->sendMailsInQueue(); will do. > Is there something else that I need to do to have the sendMail() > function delete sent mails from the queue? try with =================== while ($mail = $mail_queue->get()) { $result = $mail_queue->sendMail($mail); if (!PEAR::isError($result)) { $mail_queue->deleteMail($mail->getId()); } } =================== HTH Best regards, -- Lorenzo Alberton http://pear.php.net/user/quipo

« previous php.pear.general (#12776) next »