Implement Enhanced Mail System Status Codes (rfc1893)
Here is a list of exceptions raised by
def exception_class case @status when /\A4/ then SMTPServerBusy when /\A50/ then SMTPSyntaxError when /\A53/ then SMTPAuthenticationError when /\A5/ then SMTPFatalError else SMTPUnknownError end end
When the server responds with
Net::SMTPServerBusy: 401 4.1.3 Bad recipient address syntax it raises
SMTPServerBusy where it could use the enhanced information and throw a more specific error such as
BadMailboxAddressSyntax based on what the RFC says:
X.1.3 Bad destination mailbox address syntax The destination address was syntactically invalid. This can apply to any field in the address. This code is only useful for permanent failures.
Then it would be easier for the client to catch such specific exceptions and handle them properly instead of dealing with more general ones.