I am using Python 3.3 and smtplib to generate and send some E-mail. I am trying to figure out how to handle some exceptions, but some of the documentation has me confused. Specifically, the documentation on the SMTPRecipientsRefused exception says:

exception smtplib.SMTPRecipientsRefused

All recipient addresses refused. The errors for each recipient are accessible through the attribute recipients, which is a dictionary of exactly the same sort as <https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail>SMTP.sendmail() returns.

But where is the "recipients" attribute? More specifically, what is it an attribute of?

My code looks something like this:

        server = smtplib.SMTP(name,port)
         server.login(userid, password)
        try:
             server.sendmail(fromline, tolist, msg)
          except smtplib.SMTPRecipientsRefused:
              (here's where I need to access the recipients attribute)

I have tried server.recipients, but get an attribute error (no such attribute). I've also tried:

          smtplib.recipients
          smtplib.SMTPRecipientsRefused.recipients

and all these indicate that there is no attribute "recipients".

So where is that "recipients" attribute?

Thanks.

Hobie Audet 
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to