Sending an email with a binary attachment

Grant Edwards invalid at invalid.invalid
Mon Feb 29 13:22:29 EST 2016


On 2016-02-29, Peter Pearson <pkpearson at nowhere.invalid> wrote:
> On Mon, 29 Feb 2016 02:10:00 -0600, Anthony Papillion wrote:
>
>> For some reason though, sending mail is failing every time. I've made
>> sure that the password is correct (which seems to be the most usual
>> error).
>>
>> Still, I just can't get it to work. Can someone take a look at this
>> code and give me some advice?
>
> What exactly do you mean by "failing"?  If there's an error message,
> show it.  If an exception is being generated, at least print some
> information about the exception.

If you aren't getting any messages, then tell the smtp object you want some:

>From TFM (https://docs.python.org/3/library/smtplib.html#smtp-objects):

  An SMTP instance has the following methods:

   SMTP.set_debuglevel(level)

      Set the debug output level. A value of 1 or True for level
      results in debug messages for connection and for all messages
      sent to and received from the server. A value of 2 for level
      results in these messages being timestamped.

If all else fails, fire up wireshark and watch the conversation
between the SMTP object and the server.

-- 
Grant Edwards               grant.b.edwards        Yow! Can you MAIL a BEAN
                                  at               CAKE?
                              gmail.com            



More information about the Python-list mailing list