This commit is contained in:
Kovid Goyal 2010-10-11 10:18:47 -06:00
parent 579bc27796
commit 310b5c34b7

View File

@ -11,6 +11,7 @@ This module implements a simple commandline SMTP client that supports:
import sys, traceback, os
from email import encoders
from calibre import isbytestring
def create_mail(from_, to, subject, text=None, attachment_data=None,
attachment_type=None, attachment_name=None):
@ -26,7 +27,10 @@ def create_mail(from_, to, subject, text=None, attachment_data=None,
if text is not None:
from email.mime.text import MIMEText
msg = MIMEText(text, 'plain', 'utf-8')
if isbytestring(text):
msg = MIMEText(text)
else:
msg = MIMEText(text, 'plain', 'utf-8')
outer.attach(msg)
if attachment_data is not None: