Error 10060 while sending but no exception thrown

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
Krishan
Forum Newbie
Posts: 5
Joined: Fri Aug 31, 2007 9:17 am

Error 10060 while sending but no exception thrown

Post by Krishan »

Hi all.

Thanks d11wtq for the script. It works fine now after some difficulties. But if I try to use it in my university network it say "e-mails sent", but no e-mails are sent. It's clear, that I'm not able to send over another SMTP server but the university one as it is restricted. But the script does not throw an error but continues to send. I activated logging and it shows the following:

Code: Select all

++ Log level changed to 4 ++ Trying to connect... ++ Trying to connect to SMTP server at 'mail.xxxxx.net:25 !! The SMTP connection failed to start [mail.xxxxx.net:25]: fsockopen returned Error Number 10060 and Error String 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ' >> ++ Message sent to 1/1 recipients ++ Closing down SMTP connection.
As you see, the connection fails (correctly), but Swift continues to send mails (that ARE NOT sent).

I'm using Swift 3.3.1 for PHP4 on PHP 5.2.2 (for compatibility reasons).

What's going wrong here?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Can you post the code please?

EDIT | I'm not convinced Swift has actually tried sending the email because there should be far more log entries if it did. It's more than likely an error in my logging logic.
Krishan
Forum Newbie
Posts: 5
Joined: Fri Aug 31, 2007 9:17 am

Post by Krishan »

Thanks for the quick reply. Sorry, I can't post the code as it is too widely spread in my PHP class :oops:

Well, I played a bit with the code. I guess I solved it. The problem was that Swift throws an exception, that the connection is blocked and my error handler catches it. But I did not stop the script from trying to send mails afterwards. Then Swift tries to send something and tells, it sent mails - what it should not do, as it didn't send anything. If it would have said "no mails sent" I would show the error messages caught with the handler. If everything was fine I don't need to show any messages and the user thinks, mails were sent.

My (I think correct) workaround is, that if there was any error thrown establishing the connection my script sets an error flag in my class and won't continue sending mails. I then tell my users, no e-mails were sent and shows the relevant parts of the Swift error message.

If you could fix the problem with telling lies while sending mails - that would be great. Anyways I fixed it for me and you may close this thread. If you need further information just ask me.
Post Reply