[FIX] mass_mailing: fixed issue when generating unsubscirbe urlé
authorThibault Delavallée <tde@openerp.com>
Tue, 15 Apr 2014 16:07:43 +0000 (18:07 +0200)
committerThibault Delavallée <tde@openerp.com>
Tue, 15 Apr 2014 16:07:43 +0000 (18:07 +0200)
bzr revid: tde@openerp.com-20140415160743-5i0pjieo4o031ico

addons/mass_mailing/models/mail_mail.py

index e27156e..a67f88a 100644 (file)
@@ -83,8 +83,8 @@ class MailMail(osv.Model):
 
     def send_get_email_dict(self, cr, uid, mail, partner=None, context=None):
         res = super(MailMail, self).send_get_email_dict(cr, uid, mail, partner, context=context)
-        if mail.mailing_id and res.get('body'):
-            email_to = tools.email_split(res.get('email_to'))
+        if mail.mailing_id and res.get('body') and res.get('email_to'):
+            email_to = tools.email_split(res.get('email_to')[0])
             unsubscribe_url = self._get_unsubscribe_url(cr, uid, mail, email_to, context=context)
             if unsubscribe_url:
                 res['body'] = tools.append_content_to_html(res['body'], unsubscribe_url, plaintext=False, container_tag='p')