Re: Background process (sending mails)

From: Date: Thu, 22 Aug 2002 21:37:42 +0000
Subject: Re: Background process (sending mails)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-113681@lists.php.net to get a copy of this message
The problem with this, is that messages only queue at a max of 1,000 per minute (depending on hardware). If you're sending 100,000 mailings, the script still runs for over an hour, and does not return immediately. --- Rasmus Lerdorf <rasmus@php.net> wrote: > Simply configure your MTA to queue requests coming > from PHP. Your php.ini > file has the sendmail invocation line that is used > by PHP's mail() > function. Most MTA's out there have a sendmail-like > interface and most > have a way to tell it to simply queue the request > and return immediately. > > For sendmail you tell it to queue by adding a option > to the command line > specified in php.ini using the -o flag. Check your > sendmail docs for the > actual option, but on my system my docs say: > > DeliveryMode=x > Set the delivery mode to x. Delivery modes > are `i' for > interactive (synchronous) delivery, `b' for > background > (asynchronous) delivery, `q' for queue only - > i.e., actual > delivery is done the next time the queue is run, > and > d' for deferred - the same as q' except that > database > lookups for maps which have set the -D option > (default > for the host map) are avoided. > > Don't forget that if you just queue the mssages, you > need to flush the > queue every now and then. Traditionally that is > done by a cron job that > runs periodically and calls sendmail to flush the > queue. > > -Rasmus > > On Wed, 21 Aug 2002, Pupeno wrote: > > > I know this issue have been discussed a lot of > times but I checked a lot of > > archives and documents and I couldn't find any > solution. > > What I want to do is send a lot of mails (belive > me, it's not spamming) and > > I thought about running the process of sending > mails in background > > (detached from the PHP script that runs it), so > the page will return > > immediatly and the other process will continue > sending the mails in the > > background. > > I didn't find any way to run a process in the > background from PHP > > succesfully. > > The manual says that using system(), if the stdout > is redirected to a file, > > it's run in background, I tryed redirecting > stdout, stderr and stdin > > to/from files and it still waits for the > termination of the process, I > > tryed adding & at the end of the process line and > it didn't work neither. > > Any idea of how I can do this (without using at, > but maybe cron, I don't > > know how) ? > > Thank you. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: > http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com

« previous php.general (#113681) next »