Browse Source

Add kwargs to utils.send_templated_email()

Jocelyn Delande 9 years ago
parent
commit
9da4321e2f
1 changed files with 4 additions and 2 deletions
  1. 4 2
      coin/utils.py

+ 4 - 2
coin/utils.py

@@ -47,9 +47,11 @@ def ldap_hash(password):
         return password
 
 
-def send_templated_email(to, subject_template, body_template, context={}, attachements=[]):
+def send_templated_email(to, subject_template, body_template, context={}, attachements=[], **kwargs):
     """
     Send a multialternative email based on html and optional txt template.
+
+    :param **kwargs: extra-args pased as-is to EmailMultiAlternatives()
     """
 
     # Ensure arrays when needed
@@ -84,7 +86,7 @@ def send_templated_email(to, subject_template, body_template, context={}, attach
         text_content = html2text.html2text(html_content)
 
     # make multipart email default : text, alternative : html
-    msg = EmailMultiAlternatives(subject=subject, body=text_content, to=to)
+    msg = EmailMultiAlternatives(subject=subject, body=text_content, to=to, **kwargs)
     msg.attach_alternative(html_content, "text/html")
 
     # Set attachements