The correct way to manage SMTP errors

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
andrei.fratu
Forum Newbie
Posts: 2
Joined: Sun Sep 07, 2008 3:14 am

The correct way to manage SMTP errors

Post by andrei.fratu »

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!
Post Reply