The correct way to manage SMTP errors
Posted: Thu Sep 18, 2008 5:59 am
Hi, I am trying to build an application for sending newsletters using Swiftmailer, but I ran into some problems.
I am not very sure about what is the correct way to respond to SMTP server errors.
For example, at one point the SMTP server I was using, threw a 552 error code at me. Swiftmailer threw an exception which I caught with a try and catch block. Inside the catch block I tried to do a $swift->reset(). I didn't work, the server didn't accept the command. The next time this happened I tried a $swift->disconnect() followed by a $swift->connect(). Once again, the server wouldn't accept the QUIT command sent by $swift->disconnect().
Can anyone please help me understand what is the right way to manage such situations? I am happy to provide any extra information you might need. Thanks!
I am not very sure about what is the correct way to respond to SMTP server errors.
For example, at one point the SMTP server I was using, threw a 552 error code at me. Swiftmailer threw an exception which I caught with a try and catch block. Inside the catch block I tried to do a $swift->reset(). I didn't work, the server didn't accept the command. The next time this happened I tried a $swift->disconnect() followed by a $swift->connect(). Once again, the server wouldn't accept the QUIT command sent by $swift->disconnect().
Can anyone please help me understand what is the right way to manage such situations? I am happy to provide any extra information you might need. Thanks!