(recipients, domain=None)
return [recipient for recipient in recipients if recipient not in bounced_emails]
This filters out any emails that have reported hard bounces or complaints to
    Amazon SES
    :param recipients: list of recipient emails
    :return: list of recipient emails not marked as bounced
This filters out any emails that have reported hard bounces or complaints to
    Amazon SES
    :param recipients: list of recipient emails
    :return: list of recipient emails not marked as bounced
This filters out any emails that have reported hard bounces or complaints to Amazon SES : param recipients : list of recipient emails : return : list of recipient emails not marked as bounced
def get_valid_recipients(recipients, domain=None):
    """
    This filters out any emails that have reported hard bounces or complaints to
    Amazon SES
    :param recipients: list of recipient emails
    :return: list of recipient emails not marked as bounced
    """
    from corehq.toggles import BLOCKED_DOMAIN_EMAIL_SENDERS
    if domain and BLOCKED_DOMAIN_EMAIL_SENDERS.enabled(domain):
        # don't sent email if domain is blocked
        metrics_gauge('commcare.bounced_email', len(recipients), tags={
            'email_domain': domain,
        }, multiprocess_mode=MPM_LIVESUM)
        return []

    from corehq.util.models import BouncedEmail
    bounced_emails = BouncedEmail.get_hard_bounced_emails(recipients)
    for bounced_email in bounced_emails:
        try:
            email_domain = bounced_email.split('@')[1]
        except IndexError:
            email_domain = bounced_email
        metrics_gauge('commcare.bounced_email', 1, tags={
            'email_domain': email_domain,
        }, multiprocess_mode=MPM_LIVESUM)
    return [recipient for recipient in recipients if recipient not in bounced_emails]
def get_valid_recipients ( recipients , domain = None ) : from corehq . toggles import BLOCKED_DOMAIN_EMAIL_SENDERS if domain and BLOCKED_DOMAIN_EMAIL_SENDERS . enabled ( domain ) : # don't sent email if domain is blocked metrics_gauge ( 'commcare.bounced_email' , len ( recipients ) , tags = { 'email_domain' : domain , } , multiprocess_mode = MPM_LIVESUM ) return [ ] from corehq . util . models import BouncedEmail bounced_emails = BouncedEmail . get_hard_bounced_emails ( recipients ) for bounced_email in bounced_emails : try : email_domain = bounced_email . split ( '@' ) [ 1 ] except IndexError : email_domain = bounced_email metrics_gauge ( 'commcare.bounced_email' , 1 , tags = { 'email_domain' : email_domain , } , multiprocess_mode = MPM_LIVESUM ) return [ recipient for recipient in recipients if recipient not in bounced_emails ]