According to section 4.2.4 on the RFC 282, the SMTP server should return 502 only when a command is recognised but not implemented, and 500 if it isn't recognised.
Whe I connect to my postfix server and enter some random commands (ie knodwfonfwdnoi) I get a 502 error message instead of a 500. So I suppose that in order to acomplish with RFC 2821 it should return a 500 error intead.
signature.asc
Description: OpenPGP digital signature