Skip to content

Commit

Permalink
MIMEPart does not exist in Python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortal committed May 1, 2015
1 parent 161fda0 commit 1592c8e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion emailtunnel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ def set_unique_header(self, key, value):
self.message[key] = value

def set_body_text(self, body, encoding):
body_part = email.message.MIMEPart()
if six.PY3:
body_part = email.message.MIMEPart()
else:
body_part = email.message.Message()
if encoding:
encoded = body.encode(encoding)
body_part.set_payload(encoded)
Expand Down

0 comments on commit 1592c8e

Please sign in to comment.