def send_email(to: AddressesType, subject: str, html_content: str, files: Optional[AddressesType]=None, cc: Optional[AddressesType]=None, bcc: Optional[AddressesType]=None, sandbox_mode: bool=False, **kwargs) -> None:
    '\n    Send an email with html content using `Sendgrid <https://sendgrid.com/>`__.\n\n    .. note::\n        For more information, see :ref:`email-configuration-sendgrid`\n    '
    if (files is None):
        files = []
    mail = Mail()
    from_email = (kwargs.get('from_email') or os.environ.get('SENDGRID_MAIL_FROM'))
    from_name = (kwargs.get('from_name') or os.environ.get('SENDGRID_MAIL_SENDER'))
    mail.from_email = Email(from_email, from_name)
    mail.subject = subject
    mail.mail_settings = MailSettings()
    if sandbox_mode:
        mail.mail_settings.sandbox_mode = SandBoxMode(enable=True)
    personalization = Personalization()
    to = get_email_address_list(to)
    for to_address in to:
        personalization.add_to(Email(to_address))
    if cc:
        cc = get_email_address_list(cc)
        for cc_address in cc:
            personalization.add_cc(Email(cc_address))
    if bcc:
        bcc = get_email_address_list(bcc)
        for bcc_address in bcc:
            personalization.add_bcc(Email(bcc_address))
    pers_custom_args = kwargs.get('personalization_custom_args', None)
    if isinstance(pers_custom_args, dict):
        for key in pers_custom_args.keys():
            personalization.add_custom_arg(CustomArg(key, pers_custom_args[key]))
    mail.add_personalization(personalization)
    mail.add_content(Content('text/html', html_content))
    categories = kwargs.get('categories', [])
    for cat in categories:
        mail.add_category(Category(cat))
    for fname in files:
        basename = os.path.basename(fname)
        with open(fname, 'rb') as file:
            content = base64.b64encode(file.read()).decode('utf-8')
        attachment = Attachment(file_content=content, file_type=mimetypes.guess_type(basename)[0], file_name=basename, disposition='attachment', content_id=f'<{basename}>')
        mail.add_attachment(attachment)
    _post_sendgrid_mail(mail.get())
Send an email with html content using `Sendgrid <https://sendgrid.com/>`__.

.. note::
    For more information, see :ref:`email-configuration-sendgrid`
def send_email(to: AddressesType, subject: str, html_content: str, files: Optional[AddressesType]=None, cc: Optional[AddressesType]=None, bcc: Optional[AddressesType]=None, sandbox_mode: bool=False, **kwargs) -> None:
    '\n    Send an email with html content using `Sendgrid <https://sendgrid.com/>`__.\n\n    .. note::\n        For more information, see :ref:`email-configuration-sendgrid`\n    '
    if (files is None):
        files = []
    mail = Mail()
    from_email = (kwargs.get('from_email') or os.environ.get('SENDGRID_MAIL_FROM'))
    from_name = (kwargs.get('from_name') or os.environ.get('SENDGRID_MAIL_SENDER'))
    mail.from_email = Email(from_email, from_name)
    mail.subject = subject
    mail.mail_settings = MailSettings()
    if sandbox_mode:
        mail.mail_settings.sandbox_mode = SandBoxMode(enable=True)
    personalization = Personalization()
    to = get_email_address_list(to)
    for to_address in to:
        personalization.add_to(Email(to_address))
    if cc:
        cc = get_email_address_list(cc)
        for cc_address in cc:
            personalization.add_cc(Email(cc_address))
    if bcc:
        bcc = get_email_address_list(bcc)
        for bcc_address in bcc:
            personalization.add_bcc(Email(bcc_address))
    pers_custom_args = kwargs.get('personalization_custom_args', None)
    if isinstance(pers_custom_args, dict):
        for key in pers_custom_args.keys():
            personalization.add_custom_arg(CustomArg(key, pers_custom_args[key]))
    mail.add_personalization(personalization)
    mail.add_content(Content('text/html', html_content))
    categories = kwargs.get('categories', [])
    for cat in categories:
        mail.add_category(Category(cat))
    for fname in files:
        basename = os.path.basename(fname)
        with open(fname, 'rb') as file:
            content = base64.b64encode(file.read()).decode('utf-8')
        attachment = Attachment(file_content=content, file_type=mimetypes.guess_type(basename)[0], file_name=basename, disposition='attachment', content_id=f'<{basename}>')
        mail.add_attachment(attachment)
    _post_sendgrid_mail(mail.get())