I have a question about the way you handle "550 - Recipient not here" errors. It appears that after you receive this kind of error from the SMTP server, you abort the email and then try to send an error email back to the sender.
However, if the email has multiple recipients and only one is bad, the message is not getting sent to the good recipients.
When I look at the communication between my outlook client and my SMTP server, the way it handles this situation is that Outlook receives replies for each recipient, some 250 - sender ok, and a 550 - Recipient not here, but it still continues on to the DATA section and delivers the message.
When SpamFilter forwards this same message to my SMTP server, after it receives even a single "550 - Recipient not here", it just drops the connection. As a matter of fact, it doesn't even appear to send a "QUIT" message; it just kind of leaves the SMTP server hanging (though it appears to handle this by timing out, I assume).
My suggestion would be to continue processing and sending the email even if one of these 550 errors is received. You could store each error and make note of them in the error message.
One other suggestion would be to simply forward each 550 error back to the sending SMTP server as they happen and let it handle them. Then you won't even have to worry about sending out the error email. My Outlook client sends me a nice message whenever it encounters these types of errors while sending a message; and this cuts down on overhead because it does not require sending out a second message.
-Chad
|