Error handling in smtp

Andrew Bennetts andrew-pythonlist at puzzling.org
Thu Mar 25 06:34:10 EST 2004


On Thu, Mar 25, 2004 at 03:22:35AM -0800, james blair wrote:
> Hi
> I want to handle all the error that are thrown by smtp
> Do I have to handle each error seperately
> i.e
> except SMTPConnectError:
> except SMTPResponseException: etc

Quick glance at the smtplib module suggests that all of its exceptions
inherit from SMTPException, so "except SMTPException:" should do what you
want.

-Andrew.





More information about the Python-list mailing list