[FIX] Send mail : Non-English characters were throwing error.

lp bug: https://launchpad.net/bugs/421162 fixed

bzr revid: jvo@tinyerp.com-20090831062243-qm4bnnvvx93xvsyi
This commit is contained in:
Christophe chauvet(Syleam) 2009-08-31 11:52:43 +05:30 committed by Jay (Open ERP)
parent d8c6e2bab3
commit 1737b613a9
1 changed files with 2 additions and 2 deletions

View File

@ -331,7 +331,7 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non
email_bcc = []
if not attach:
msg = MIMEText(body or '',_subtype=subtype,_charset='utf-8')
msg = MIMEText(body.encode('utf-8') or '',_subtype=subtype,_charset='utf-8')
else:
msg = MIMEMultipart()
@ -362,7 +362,7 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non
msg['Message-Id'] = "<%s-tinycrm-%s@%s>" % (time.time(), tinycrm, socket.gethostname())
if attach:
msg.attach( MIMEText(body or '', _charset='utf-8', _subtype=subtype) )
msg.attach( MIMEText(body.encode('utf-8') or '', _charset='utf-8', _subtype=subtype) )
for (fname,fcontent) in attach:
part = MIMEBase('application', "octet-stream")