Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: MIMEText instance has no attribute 'as_bytes' #14

Open
Zhanweelee opened this issue Feb 12, 2020 · 0 comments
Open

AttributeError: MIMEText instance has no attribute 'as_bytes' #14

Zhanweelee opened this issue Feb 12, 2020 · 0 comments

Comments

@Zhanweelee
Copy link

environment:
Linux instance-1 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
pip:
gmail-api-wrapper==0.1.1a2

code:

# -*- coding: utf8 -*-
from gmail_api_wrapper.crud.write import GmailAPIWriteWrapper

api = GmailAPIWriteWrapper()
# compose new mail
import datetime
nowstr = datetime.datetime.strftime(datetime.datetime.now(), "%Y-%m-%d %H%M%S")
subject = "test"
body = nowstr
print api.compose_mail(subject=subject, body=body, to='xxxx@gmail.com')

error:


Traceback (most recent call last):
  File "sendmail.py", line 10, in <module>
    print api.compose_mail(subject=subject, body=body, to='xxxx@gmail.com')
  File "/xxxxx/.local/lib/python2.7/site-packages/gmail_api_wrapper/crud/write.py", line 92, in compose_mail
    b64_raw = base64.urlsafe_b64encode(message.as_bytes())
AttributeError: MIMEText instance has no attribute 'as_bytes'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant