Added subtype arguement for emailing HTML format emails.
bzr revid: jvo@tinyerp.com-20081104063323-1xokh2az5bvbwyp9
This commit is contained in:
parent
62977c6be1
commit
1f1556ffba
|
@ -50,7 +50,7 @@ def _mass_mail_send(self, cr, uid, data, context):
|
||||||
to = '%s <%s>' % (name, adr.email)
|
to = '%s <%s>' % (name, adr.email)
|
||||||
#TODO: add some tests to check for invalid email addresses
|
#TODO: add some tests to check for invalid email addresses
|
||||||
#CHECKME: maybe we should use res.partner/email_send
|
#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
|
nbr += 1
|
||||||
pooler.get_pool(cr.dbname).get('res.partner.event').create(cr, uid,
|
pooler.get_pool(cr.dbname).get('res.partner.event').create(cr, uid,
|
||||||
{'name': 'Email sent through mass mailing',
|
{'name': 'Email sent through mass mailing',
|
||||||
|
|
|
@ -322,7 +322,7 @@ def reverse_enumerate(l):
|
||||||
#----------------------------------------------------------
|
#----------------------------------------------------------
|
||||||
# Emails
|
# 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."""
|
"""Send an email."""
|
||||||
if not email_cc:
|
if not email_cc:
|
||||||
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.Header import Header
|
||||||
from email.Utils import formatdate, COMMASPACE
|
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['Subject'] = Header(subject.decode('utf8'), 'utf-8')
|
||||||
msg['From'] = email_from
|
msg['From'] = email_from
|
||||||
del msg['Reply-To']
|
del msg['Reply-To']
|
||||||
|
|
Loading…
Reference in New Issue