Re: outgoing mail function freezing problem

From: Date: Mon, 14 Oct 2002 13:06:43 +0000
Subject: Re: outgoing mail function freezing problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-119877@lists.php.net to get a copy of this message
scott wrote:
My mail function is sending out a few hundred or so mail address but keeps hanging when it gets to sending a mail form a certain domain. Probably DNS. Try doing a "dig thedomain.com" (assuming linux) on the domain it is going to. I suspect there is not an entry thus it will hang until DNS times out.
As the script hangs at this point I can't send anymore mails once the script encounters an address from x domain. What would be the best way to work around this? Why is mail() hanging? In my opinion, if you are sending all the emails from a single PHP script, do one per script (depends upon how the maximum execution time works). Or use cron/at to do it outside of waiting for a web page. I admit that I use perl for this part, calling it from "at".
How would you suggest incorporating a timeout so that the script continues once mail() has not exited for more than say 5 seconds???? mail() is a blocking call, so it won't exit until it has either successfully sent an email or has failed.
HTH Chris

« previous php.general (#119877) next »