[Tutor] SMTPLIB Exception Object
alan.gauld at btinternet.com
Wed Apr 23 11:23:50 CEST 2014
On 23/04/14 04:35, Hobie Audet wrote:
> documentation has me confused. Specifically, the documentation on the
> SMTPRecipientsRefused exception says:
> All recipient addresses refused. The errors for each recipient are
> accessible through the attribute recipients,...
> But where is the "recipients" attribute? More specifically, what is it
> an attribute of?
Since its talking about the exception I'd assume its an attribute
of the exception object.
> server.sendmail(fromline, tolist, msg)
> except smtplib.SMTPRecipientsRefused:
But you are not fetching the exception object so you need to change your
except line to be (assuming Python v3):
except smtplib.SMTPRecipientsRefused as err:
Now you can access err.recipients
Author of the Learn to Program web site
More information about the Tutor