From 1f1556ffba922823a7771ac41c1d7f3fdbaf4a29 Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Tue, 4 Nov 2008 12:03:23 +0530 Subject: [PATCH] Added subtype arguement for emailing HTML format emails. bzr revid: jvo@tinyerp.com-20081104063323-1xokh2az5bvbwyp9 --- bin/addons/base/res/partner/wizard/wizard_spam.py | 4 ++-- bin/tools/misc.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/addons/base/res/partner/wizard/wizard_spam.py b/bin/addons/base/res/partner/wizard/wizard_spam.py index e12f3ab36e7..030283bbe44 100644 --- a/bin/addons/base/res/partner/wizard/wizard_spam.py +++ b/bin/addons/base/res/partner/wizard/wizard_spam.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -50,7 +50,7 @@ def _mass_mail_send(self, cr, uid, data, context): to = '%s <%s>' % (name, adr.email) #TODO: add some tests to check for invalid email addresses #CHECKME: maybe we should use res.partner/email_send - tools.email_send(data['form']['from'], [to], data['form']['subject'], data['form']['text']) + tools.email_send(data['form']['from'], [to], data['form']['subject'], data['form']['text'],subtype='html') nbr += 1 pooler.get_pool(cr.dbname).get('res.partner.event').create(cr, uid, {'name': 'Email sent through mass mailing', diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 420dd9b9e1b..ec4c92d1858 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -322,7 +322,7 @@ def reverse_enumerate(l): #---------------------------------------------------------- # Emails #---------------------------------------------------------- -def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, tinycrm=False, ssl=False, debug=False): +def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, on_error=False, reply_to=False, tinycrm=False, ssl=False, debug=False,subtype='plain'): """Send an email.""" if not email_cc: email_cc=[] @@ -334,7 +334,7 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non from email.Header import Header from email.Utils import formatdate, COMMASPACE - msg = MIMEText(body or '', _charset='utf-8') + msg = MIMEText(body or '',_subtype=subtype,_charset='utf-8') msg['Subject'] = Header(subject.decode('utf8'), 'utf-8') msg['From'] = email_from del msg['Reply-To']