stevepatd Posted 6 hours ago Share Posted 6 hours ago I just updated PHPMailer from version 5.1 to 6.10.0. I was successfully sending small batches of emails today, so I thought everything was great. Tonight I went to run a job that was going to send a couple thousand emails out and it stopped about a third of the way through. It just stopped sending out emails after about 369 emails. I started it again from the point where it quit and it only made it through the next 500ish. After starting from that spot it made it through the list. There are no errors messages, no error logs, no debugging logs. I never had anything like this happen when running v5.1. Nothing else changed in my code, data files, etc. So I am wondering if there is some limiting factor with the newer PHPMailer? Does it take more memory? I'm looking for ideas on how to debug this. Any relevant differences between PHPMailer 5.1 and 6.10.0? Suggestions how I should debug it? Other than the first 4 lines of code below, nothing has changed. I find it hard to believe it is a code issue since this has been running for many years without issue. Ideas where I should start? require_once 'include_files/PHPMailer/PHPMailer_v6.10.0/PHPMailer/Exception.php'; require_once 'include_files/PHPMailer/PHPMailer_v6.10.0/PHPMailer/PHPMailer.php'; require_once 'include_files/PHPMailer/PHPMailer_v6.10.0/PHPMailer/SMTP.php'; $mailer = new PHPMailer\PHPMailer\PHPMailer(true); $mailer -> IsSMTP(); $mailer -> Host = 'smtp.mandrillapp.com'; $mailer -> SMTPAuth = true; $mailer -> Username = 'myusername'; $mailer -> Password = 'mypassword'; $mailer -> SMTPSecure = 'tls'; $mailer -> Port = 587; $mailer -> IsHTML(true); $mailer -> AddReplyTo('My Email'); $mailer -> FromName = "My Name"; $mailer -> From = 'My Email'; $mailer -> AddAddress('Your Email'); $mailer -> Subject = 'My Subject'; $mailer -> Body = 'My Message'; if ($mailer -> Send()) { } else { print "Mailer Error: " . $mailer->ErrorInfo; } Quote Link to comment https://forums.phpfreaks.com/topic/330186-phpmailer-stops-sending-out-emails/ Share on other sites More sharing options...
mac_gyver Posted 2 hours ago Share Posted 2 hours ago how are you invoking this? is the code looping over data, and if so what is the code with the looping? approximately how long was the execution time for each of the segments of sent emails? you are using exceptions for errors. when using exceptions, none of the discrete error checking logic will ever get executed upon an error and should be removed. when using exceptions for errors, unless you are doing something special with the error information, you should not catch and handle exceptions in your code. instead let php catch and handle any exception, where php will use its error related settings (error_reporting, display_errors, and log_errors) to control what happens with the actual error information, via an uncaught exception error. php's error_reporting should always be set to E_ALL. if you are invoking this via a browser, you should set display_errors to ON, so that any php detected errors (which will include any uncaught exceptions) will be displayed. if you are invoking this via a cron job/scheduled task, you should set log_errors to ON, so that any php detected errors will be logged. Quote Link to comment https://forums.phpfreaks.com/topic/330186-phpmailer-stops-sending-out-emails/#findComment-1658218 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.