MidOhioIT Posted May 1, 2010 Share Posted May 1, 2010 Does anyone know if there is a good way to capture errors like a SMTP timed out or a mysql timeout? I have a newsletter system that is fairly large (50,00 plus) and there are times where the server may have a hiccup or something and it would be nice if the code would catch the timeout, sleep for a minute and retry again instead of me keep checking and noticing that it stopped over an hour later.. I am just doing the standard: require_once ('class.phpmailer.php'); // read the database and get the emails.. $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->Host = "localhost"; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication Quote Link to comment Share on other sites More sharing options...
ChemicalBliss Posted May 1, 2010 Share Posted May 1, 2010 You could experiment with try{}catch{} blocks; require_once ('class.phpmailer.php'); // read the database and get the emails.. try{ $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->Host = "localhost"; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication } catch (Exception $e){ echo($e.' - Error occured'); } http://php.net/manual/en/language.exceptions.php -cb- Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.