<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def send_mail(subject, message, from_email, recipient_emails, files=None, html=False, reply_to=None, bcc=None, cc=None, files_manually=None):
 """ Sends email with advanced optional parameters To attach non-file content (e.g. content not saved on disk), use files_manually parameter and provide list of 3 element tuples, e.g. [('design.png', img_data, 'image/png'),] which will be passed to email.attach(). """

    import django.core.mail
    try:
        logging.debug('Sending mail to: {0}'.format(', '.join(r for r in recipient_emails)))
        logging.debug('Message: {0}'.format(message))
        email = django.core.mail.EmailMessage(subject, message, from_email, recipient_emails,
                                              bcc, cc=cc)
        if html:
            email.content_subtype = "html"
        if files:
            for file in files:
                email.attach_file(file)
        if files_manually:
            for filename, content, mimetype in files_manually:
                email.attach(filename, content, mimetype)
        if reply_to:
            email.extra_headers = {'Reply-To': reply_to}
        email.send()
    except Exception as e:
        # TODO:  Raise error again so that more information is included in the logs?
        logging.error('Error sending message [{0}] from {1} to {2} {3}'.format(
            subject, from_email, recipient_emails, e))