<commit_before>from django.core.mail import EmailMultiAlternatives, get_connection
from django.utils.encoding import force_unicode

from .models import Email, PRIORITY, STATUS
from .settings import get_backend


def send_mail(subject, message, from_email, recipient_list,
              fail_silently=False, auth_user=None, auth_password=<PASSWORD>,
              connection=None, html_message='', priority=PRIORITY.medium):
    """
    Add a new message to the mail queue.

    This is a replacement for Django's ``send_mail`` core email method.

    The `fail_silently``, ``auth_user`` and ``auth_password`` arguments are
    only provided to match the signature of the emulated function. These
    arguments are not used.
    """

    subject = force_unicode(subject)
    # Turn the input to django's email object to check for failures
    msg = EmailMultiAlternatives(subject, message, from_email,
                                 recipient_list, connection=connection)
    status = None if priority == PRIORITY.now else STATUS.queued

    for address in recipient_list:
        email = Email.objects.create(from_email=from_email, to=address, subject=subject,
            message=message, html_message=html_message, status=status, priority=priority)
        if priority == PRIORITY.now:
            email.dispatch(connection=connection)<commit_msg>send_mail no longer accepts connection, auth_user, auth_password<commit_after>from django.core.mail import EmailMultiAlternatives, get_connection
from django.utils.encoding import force_unicode

from .models import Email, PRIORITY, STATUS
from .settings import get_backend


def send_mail(subject, message, from_email, recipient_list, html_message='',
              priority=PRIORITY.medium):
    """
    Add a new message to the mail queue.

    This is a replacement for Django's ``send_mail`` core email method.

    The `fail_silently``, ``auth_user`` and ``auth_password`` arguments are
    only provided to match the signature of the emulated function. These
    arguments are not used.
    """

    subject = force_unicode(subject)
    # Turn the input to django's email object to check for failures
    msg = EmailMultiAlternatives(subject, message, from_email,
                                 recipient_list)
    status = None if priority == PRIORITY.now else STATUS.queued

    for address in recipient_list:
        email = Email.objects.create(from_email=from_email, to=address, subject=subject,
            message=message, html_message=html_message, status=status, priority=priority)
        if priority == PRIORITY.now:
            email.dispatch()
{'fraction_non_alphanumeric': 0.07762906309751434, 'fraction_numerical': 0.0, 'mean_word_length': 3.557491289198606, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3996812', 'n_tokens_mistral': 704, 'n_tokens_neox': 674, 'n_words': 224}