Page 1 of 1
smtp connection failure
Posted: Thu Jan 24, 2008 9:06 am
by s.dot
I've just recently been getting this message, without changing any files on the server. I can send an email to myself using thunderbird so I know the server is responsive and running. But my emails through my web site are not sending.
Code: Select all
Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [smtp.1and1.com:25]: fsockopen returned Error Number 42 and Error String ''' in /home/bluesurf/public_html/lib/Swift/Connection/SMTP.php:309
What could have happened?
Re: smtp connection failure
Posted: Thu Jan 24, 2008 9:37 am
by s.dot
OK, so now it is working. Odd =/
Re: smtp connection failure
Posted: Thu Jan 24, 2008 1:01 pm
by s.dot
If I wrap the code up like this..
Code: Select all
try
{
if ($swift->send())
{
$numSent++;
}
} catch (Exception $e)
{
//do nothing
}
Will this prevent fatal errors from happening in the future?
I want to allow the script to continue if the email sending fails.
I would try it but this system is live.
Re: smtp connection failure
Posted: Thu Jan 24, 2008 2:02 pm
by Oren
If the fatal errors you are getting are caused by uncaught exceptions then yes, otherwise - no.
Re: smtp connection failure
Posted: Thu Jan 24, 2008 2:35 pm
by Chris Corbyn
scottay, you'd have to put some logic in the catch() block to ensure Swift is restarted and/or the error is handled. Swift wouldn't stop if it could easily carry on (in the case the connection was refused so swift couldn't just carry on ignoring that fact

)
Re: smtp connection failure
Posted: Thu Jan 24, 2008 6:01 pm
by s.dot
Well, on the pages where I'm just sending a single email, then it would work.. right? I mean swift would error out (because it can't connect) but the rest of my script would continue.
Re: smtp connection failure
Posted: Thu Jan 24, 2008 6:22 pm
by Chris Corbyn
scottayy wrote:Well, on the pages where I'm just sending a single email, then it would work.. right? I mean swift would error out (because it can't connect) but the rest of my script would continue.
Correct
