Postfix socket responses problem

postfixsocket

I am writing a program in Flex/Actionscript and using an Apple OSX server running Postfix.
If a mail canot be sent, it is stored in a database to be sent at a later date.

My problem is that if I have, say, 3 email messages in the database, then I need to know which ones (if any) have been successfully queued, when I try to send them, to my postfix server.

However the responses are not returned in order?

Below is an example of the response for 3 emails.

Points to note:
I inject a VRFY for an unknown user (so that I can search for it), hence the 550 responses.

The 500 (Bad Syntax, is my bad, basically an incorrect line feed I believe)

All my mails, that should, are sent successfully, but I need to know which ones were not sent successfully, when they fail, so I don't delete them from the database, but try again

I expect the queued messages to be in the body of each email socket response, beofre the (221) Bye response, which is the case with 3 other emails sent?

Any thoughts would be welcome.

Thanks in advance for any help

Phil.

========Server responses for three emails, successfully queued ==========

220 web.org ESMTP Postfix

220 web.org ESMTP Postfix

220 web.org ESMTP Postfix

550 5.1.1 : Recipient address rejected: User unknown in local recipient table

250 deadweb.org

334 V22l225hbWU6

334 U222233vcmQ6

235 Authentication successful

250 2.1.0 Ok

250 2.1.5 Ok

500 5.5.2 Error: bad syntax

354 End data with .

550 5.1.1 : Recipient address rejected: User unknown in local recipient table

250 deadweb.org

334 V22l225hbWU6

334 U222233vcmQ6

235 Authentication successful

250 2.1.0 Ok

250 2.1.5 Ok

500 5.5.2 Error: bad syntax

354 End data with .

550 5.1.1 : Recipient address rejected: User unknown in local recipient table

250 deadweb.org

334 V22l225hbWU6

334 U222233vcmQ6

235 Authentication successful

250 2.1.0 Ok

250 2.1.5 Ok

500 5.5.2 Error: bad syntax

354 End data with .

250 2.0.0 Ok: queued as 504596E372

221 2.0.0 Bye

250 2.0.0 Ok: queued as 71F026E373

221 2.0.0 Bye

250 2.0.0 Ok: queued as 970A06E374

221 2.0.0 Bye

==========

Best Answer

Responses are returned in order within one SMTP session but you seems to have responses from three different SMTP sessions intermixed in one log. You should track each SMTP session separately and once you get 250 2.0.0 Ok: queued you are OK to remove message from database.