diff options
| author | P. Christeas <p_christ@hol.gr> | 2009-09-25 23:47:45 +0300 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2009-09-25 23:47:45 +0300 |
| commit | 71d5ee956afeca90d72a46aacf7adf8c8fed86eb (patch) | |
| tree | db40f24b13d68304d4c1dea72764ccd284cc8bad /bin/tools/misc.py | |
| parent | 282cab24a02cae313e9090eee9e3f3eff0812961 (diff) | |
| parent | 244de09ee563f0e72fa6330c71f316415bb690ad (diff) | |
Merge remote branch 'origin/master', v5.0.6 into optimize
Conflicts:
bin/addons/base/ir/ir_cron.py
bin/netsvc.py
bin/osv/orm.py
bzr revid: p_christ@hol.gr-20090925204745-352t3ngsltr4cj8a
Diffstat (limited to 'bin/tools/misc.py')
| -rw-r--r-- | bin/tools/misc.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 349085e13b6..25375037bdf 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -332,7 +332,10 @@ 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') + try: + msg = MIMEText(body.encode('utf8') or '',_subtype=subtype,_charset='utf-8') + except: + msg = MIMEText(body or '',_subtype=subtype,_charset='utf-8') else: msg = MIMEMultipart() @@ -363,8 +366,10 @@ 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) ) - + try: + msg.attach(MIMEText(body.encode('utf8') or '',_subtype=subtype,_charset='utf-8')) + except: + msg.attach(MIMEText(body or '', _charset='utf-8', _subtype=subtype) ) for (fname,fcontent) in attach: part = MIMEBase('application', "octet-stream") part.set_payload( fcontent ) |
