<commit_before>from django.core.mail import EmailMessage, send_mail
import logging


def send_redirect_report(bad_redirects):
    msg = 'The Openstax Redirect Report has been run'
    msg += '\n\nShort Code,Redirect URL'
    msg += '\n' + str(bad_redirects)

    subject = 'OpenStax Redirect Report'
    from_address = '<EMAIL>'
    to_address = ['<EMAIL>', ]

    try:
        email = EmailMessage(subject,
                             msg,
                             from_address,
                             to_address)
        email.send()

    except Exception as e:
        logger.error("EMAIL FAILED TO SEND: subject:{}".format(subject))<commit_msg>Send email exception to Sentry (#1333)<commit_after>from django.core.mail import EmailMessage, send_mail
from sentry_sdk import capture_exception


def send_redirect_report(bad_redirects):
    msg = 'The Openstax Redirect Report has been run'
    msg += '\n\nShort Code,Redirect URL'
    msg += '\n' + str(bad_redirects)

    subject = 'OpenStax Redirect Report'
    from_address = '<EMAIL>'
    to_address = ['<EMAIL>', ]

    try:
        email = EmailMessage(subject,
                             msg,
                             from_address,
                             to_address)
        email.send()

    except Exception as e:
        capture_exception(e)
{'fraction_non_alphanumeric': 0.09433962264150944, 'fraction_numerical': 0.0030188679245283017, 'mean_word_length': 2.112676056338028, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2082259', 'n_tokens_mistral': 382, 'n_tokens_neox': 371, 'n_words': 98}