I'm working on an project where I have to use the smtplib and email modules in Python ... returning AttributeError: 'str' object has no attribute 'get_all'.
Description ¶. When trying to send a EMail with attachment, it always failed with the following Exception: 'bytes' object has no attribute 'encode'. At first I thought this is a bug in django-post-office or a duplicate of this bug:
CSV File Attachment Error: 'bytes' object has no attribute 'encode' 1 Sending an email in a python script using smtplib and MIMEText, but recieving an encoding error
07.09.2014 · AttributeError: MIMEText instance has no attribute 'encode' Ask Question Asked 7 years, 3 months ago. ... AttributeError: MIMEText instance has no attribute 'encode' ... AttributeError: object has no attribute 'tk' 2.
06.05.2018 · I don't know MIMEText, but bviously your MIMEText is not a string, so you need check the doc's for a way how to get hands on the string inside and apply encode then to the string. – MBT May 6 '18 at 14:09
... line 60, in encode_7or8bit orig. encode('ascii") AttributeError: 'bytes' object has no attribute 'encode' » m = MIMEText("abc', charset="latin-1") » m ...
'bytes' object has no attribute 'encode' ... line 171, in __init__ MIMEText. ... instance # as MIMEText init parameter (http://bugs.python.org/issue16324).