help with a connection problem

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
jen-zed
Forum Newbie
Posts: 2
Joined: Thu Aug 09, 2007 11:52 pm

help with a connection problem

Post by jen-zed »

Can anyone help with a SMTP connection problem I'm having? Everything was working great on my test server, but on the production server I'm intermittently (maybe one in ten connection attempts by Swift) getting the following exception thrown:

Code: Select all

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? (fsockopen: #0) ' in [file location left out of quote]swift/Swift/Connection/SMTP.php:245 Stack trace: #0 [file location left out of quote]swift/Swift.php(313): Swift_Connection_SMTP->read() #1 [file location left out of quote]swift/Swift.php(269): Swift->command('EHLO [66.103.20...', 250) #2 [file location left out of quote]swift/Swift.php(229): Swift->handshake(Object(Swift_Events_ResponseEvent)) #3 /home/rainfor/public_html/jens_stuff/swift/Swift.php(102): Swift->connect() #4 [file location left out of quote]engine.php(36): Swift->__construct(Object(Swift_Connection_SMTP)) #5 {main} thrown in [file location left out of quote]swift/Swift/Connection/SMTP.php on line 245
Looking at the source of the page, it appears that this is happening prior to actually sending anything, so I don't think the too many emails thing applies?

I'm running version 3.2.6 on PHP 5. I have a dedicated SMTP server set up with my host and it's not been up for very long - I suspect it may be something I need to bother my hosting company about? Or is there some other action I could take?

Thanks
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

This usually happens when your network has some packet loss, or the smtp server doesn't respond correctly. The batchSend() method would try to deal with such errors itself so you don't have to, otherwise you should make use of try/catch ;)
jen-zed
Forum Newbie
Posts: 2
Joined: Thu Aug 09, 2007 11:52 pm

Post by jen-zed »

Ok, I'll explore that. Thanks for your quick response, and your great work with Swift - it has been an enormous help. Cheers.
Post Reply