Commits

Artem Gluvchynsky committed dfba6e3

#1183: changed send_html_email listener to keep send_mail_args clean, fixed send_store_mail to check for 'recipient_list' after signal processing

Comments (0)

Files changed (1)

satchmo/apps/satchmo_store/mail.py

         raise NoRecipientsException
 
     # prepare kwargs for EmailMultiAlternatives()
-    fail_silently = send_mail_args.pop('fail_silently')
-    send_mail_args['body'] = send_mail_args.pop('message') # the plain text part
-    send_mail_args['to'] = send_mail_args.pop('recipient_list')
+    multi_mail_args = send_mail_args.copy()
+    fail_silently = multi_mail_args.pop('fail_silently')
+    multi_mail_args['body'] = multi_mail_args.pop('message') # the plain text part
+    multi_mail_args['to'] = multi_mail_args.pop('recipient_list')
 
-    msg = EmailMultiAlternatives(**send_mail_args)
+    msg = EmailMultiAlternatives(**multi_mail_args)
     msg.attach_alternative(html_body, "text/html")
 
     # don't have to handle any errors, as send_store_mail() does so for us.
         except ShouldNotSendMail:
             return
 
-        if not recipients:
+        if not send_mail_args.get('recipient_list'):
             raise NoRecipientsException
 
         send_mail(**send_mail_args)