[Tutor] SMTPLIB Exception Object

Hobie Audet Hobie.Audet at comcast.net
Wed Apr 23 05:35:18 CEST 2014


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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140422/86ca1254/attachment.html>


More information about the Tutor mailing list