import logging

from django.core import mail

from .tasks import task_email_user

logger = logging.getLogger(__name__)


def email_user(user, template, context, attachments=None, delete_attachments_after_send=False, send_to=None,
               language_code=None):
    '''
    Send email to user

    :param user: User instance or None if no DB user is used
    :param template: Template to use for email
    :param context: Context for email
    :param attachments: List of attachments
    :param delete_attachments_after_send: If true, delete attachments from storage after sending
    :param send_to: email address to send (or None, to use user email address)
    :param language_code: Language code for template
    :return:
    '''

    ### check if we are using test framework
    if hasattr(mail, 'outbox'):
        ### if yes, do not defer sending email
        send_email_f = task_email_user
    else:
        ### otherwise, defer sending email to celery
        send_email_f = task_email_user.delay

    ### send email
    send_email_f(
        user.pk if user else None,
        template,
        context,
        attachments=attachments,
        delete_attachments_after_send=delete_attachments_after_send,
        send_to=send_to,
        language_code=language_code
    )

@@ -118,26 +118,26 @@
 )%0A%0A%0Adef 
+send_
 email
-_user
 (user, t
@@ -212,22 +212,8 @@
 lse,
- send_to=None,
 %0A   
@@ -315,34 +315,30 @@
  or 
-None if no DB user is used
+recipient email addres
 %0A   
@@ -564,87 +564,8 @@
 ing%0A
-    :param send_to: email address to send (or None, to use user email address)%0A
     
@@ -1047,16 +1047,16 @@
 hments,%0A
+
         
@@ -1120,33 +1120,8 @@
 nd,%0A
-        send_to=send_to,%0A
     

Rename email_user method to send_email and fix parameters