fatal error....

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
matic07
Forum Newbie
Posts: 2
Joined: Fri Feb 20, 2009 6:48 am

fatal error....

Post by matic07 »

I get this error:

Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'The SMTP connection failed to start [mail.mydomain.me:25]: fsockopen returned Error Number 110 and Error String 'Connection timed out'' in /home/mydomain/public_html/lib/Swift/Connection/SMTP.php:309 Stack trace: #0 /home/mydomain/public_html/lib/Swift.php(216): Swift_Connection_SMTP->start() #1 /home/mydomain/public_html/lib/Swift.php(101): Swift->connect() #2 /home/mydomain/public_html/test.php(24): Swift->__construct(Object(Swift_Connection_SMTP)) #3 {main} thrown in /home/mydomain/public_html/lib/Swift/Connection/SMTP.php on line 309

How can i fix that?? I've used google and forum search and i haven't found solution:(
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: fatal error....

Post by Chris Corbyn »

The connection is timing out. It sounds like there's a firewall that's blocking the connection.
BrandonMUS
Forum Newbie
Posts: 15
Joined: Mon Nov 10, 2008 9:45 am

Re: fatal error....

Post by BrandonMUS »

In Swift3 there was a way to add multiple connections to an instance of Swift. This way if one connection was unsuccessful you could use a backup solution. Is this possible in Swift4 or was it removed? I see that a bad connection throws an exception, so is the best way to do this to throw and catch? Or do you have a snippet for a better way?
matic07
Forum Newbie
Posts: 2
Joined: Fri Feb 20, 2009 6:48 am

Re: fatal error....

Post by matic07 »

Solution: staff change default SMTP port to 26 and now works :D
.. const PORT_DEFAULT = 26; ...
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: fatal error....

Post by Chris Corbyn »

BrandonMUS wrote:In Swift3 there was a way to add multiple connections to an instance of Swift. This way if one connection was unsuccessful you could use a backup solution. Is this possible in Swift4 or was it removed? I see that a bad connection throws an exception, so is the best way to do this to throw and catch? Or do you have a snippet for a better way?
Try/catch can work but there's two transports I still need to document:

Code: Select all

//Switches if a server fails
$mailer = new Swift_Mailer(Swift_FailoverTransport::newInstance(array(
  Swift_SmtpTransport::newInstance('server1'),
  Swift_SmtpTransport::newInstance('server2')
)));
 
//Switches after each message sent
$mailer = new Swift_Mailer(Swift_LoadBalancedTransport::newInstance(array(
  Swift_SmtpTransport::newInstance('server1'),
  Swift_SmtpTransport::newInstance('server2')
)));
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: fatal error....

Post by Chris Corbyn »

matic07 wrote:Solution: staff change default SMTP port to 26 and now works :D
.. const PORT_DEFAULT = 26; ...
Good to hear :)
BrandonMUS
Forum Newbie
Posts: 15
Joined: Mon Nov 10, 2008 9:45 am

Re: fatal error....

Post by BrandonMUS »

Chris Corbyn wrote:
BrandonMUS wrote:In Swift3 there was a way to add multiple connections to an instance of Swift. This way if one connection was unsuccessful you could use a backup solution. Is this possible in Swift4 or was it removed? I see that a bad connection throws an exception, so is the best way to do this to throw and catch? Or do you have a snippet for a better way?
Try/catch can work but there's two transports I still need to document:

Code: Select all

//Switches if a server fails
$mailer = new Swift_Mailer(Swift_FailoverTransport::newInstance(array(
  Swift_SmtpTransport::newInstance('server1'),
  Swift_SmtpTransport::newInstance('server2')
)));
 
//Switches after each message sent
$mailer = new Swift_Mailer(Swift_LoadBalancedTransport::newInstance(array(
  Swift_SmtpTransport::newInstance('server1'),
  Swift_SmtpTransport::newInstance('server2')
)));
Ahh, thank you. I really liked this feature in Swift3, so I was hoping it wasn't scrapped.

In fact, I see it in the docs now: http://swiftmailer.org/betas/docs/v4-wo ... nents.html I guess I just overlooked that section before. Thanks!
Post Reply