diff --git a/readthedocs/core/tasks.py b/readthedocs/core/tasks.py index c3c7f6251bc..a44cc543d81 100644 --- a/readthedocs/core/tasks.py +++ b/readthedocs/core/tasks.py @@ -17,7 +17,8 @@ @app.task(queue='web', time_limit=EMAIL_TIME_LIMIT) -def send_email_task(recipient, subject, template, template_html, context=None, from_email=None): +def send_email_task(recipient, subject, template, template_html, + context=None, from_email=None, **kwargs): """Send multipart email recipient @@ -34,12 +35,16 @@ def send_email_task(recipient, subject, template, template_html, context=None, f context A dictionary to pass into the template calls + + kwargs + Additional options to the EmailMultiAlternatives option. """ msg = EmailMultiAlternatives( subject, get_template(template).render(context), from_email or settings.DEFAULT_FROM_EMAIL, - [recipient] + [recipient], + **kwargs ) try: msg.attach_alternative(get_template(template_html).render(context), diff --git a/readthedocs/core/utils/__init__.py b/readthedocs/core/utils/__init__.py index be277991a7c..a76f5fcb6ab 100644 --- a/readthedocs/core/utils/__init__.py +++ b/readthedocs/core/utils/__init__.py @@ -134,7 +134,7 @@ def trigger_build(project, version=None, record=True, force=False, basic=False): def send_email(recipient, subject, template, template_html, context=None, - request=None, from_email=None): # pylint: disable=unused-argument + request=None, from_email=None, **kwargs): # pylint: disable=unused-argument """Alter context passed in and call email send task .. seealso:: @@ -147,7 +147,8 @@ def send_email(recipient, subject, template, template_html, context=None, context['uri'] = '{scheme}://{host}'.format( scheme='https', host=settings.PRODUCTION_DOMAIN) send_email_task.delay(recipient=recipient, subject=subject, template=template, - template_html=template_html, context=context, from_email=from_email) + template_html=template_html, context=context, from_email=from_email, + **kwargs) def slugify(value, *args, **kwargs):