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 Link to comment https://forums.phpfreaks.com/topic/200332-phpmailer-capturing-errors-bettter/ 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- Link to comment https://forums.phpfreaks.com/topic/200332-phpmailer-capturing-errors-bettter/#findComment-1051409 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.