When i use SwiftMailer, certain email addresses will cause the following Fatal Error to ouput and kill the script. UIntil i remove the email address from the db, it will always give this error ( i loop through db records and send a message to each email)..any ideas what can be done to make sure the script doesnt die when this error comes up? I am running 3.1.2 for PHP5...
Fatal error: Uncaught exception 'Swift_Connection_Exception' with message 'There was a problem reading line 1 of an SMTP response. The response so far was:<br />[]. It appears the connection has died without saying goodbye to us! Too many emails in one go perhaps?' in /home/wsuaa1/www/myalumnicommunity.com/siteadmin/lib/Swift/Connection/SMTP.php:232
Stack trace:
#0 /home/wsuaa1/www/myalumnicommunity.com/siteadmin/lib/Swift.php(307): Swift_Connection_SMTP->read()
#1 /home/wsuaa1/www/wsualumnicommunity.com/siteadmin/lib/Swift.php(381): Swift->command('RCPT TO: <kelly...', 250)
#2 /home/wsuaa1/www/myalumnicommunity.com/siteadmin/pages/newsletters/startqueue.php(185): Swift->send(Object(Swift_Message), 'kellyt@dhcpo.ci...', Object(Swift_Address))
#3 {main}
thrown in /home/wsuaa1/www/myalumnicommunity.com/siteadmin/lib/Swift/Connection/SMTP.php on line 232
Fatal error: Uncaught exception 'Swift_Connection_Exception'
Moderators: Chris Corbyn, General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
My email wrote:This usually happens when you overload the SMTP server or the web server but it may also occur if the SMTP server is configured to do reverse name lookups which can take a while. Increase the timeout on the connection to 30 seconds or so:
Let me know if that doesn't help youCode: Select all
$conn = new Swift_Connection_SMTP("foo"); $conn->setTimeout(30); $swift = new Swift($conn);
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
By the way, there's a reason Swift uses exceptions:
Code: Select all
foreach ($the_recipients as $recipient)
{
try {
$swift->send( ... );
} catch (Exception $e) {
do_something_with_failed($recipient);
$swift->reset();
}
}