Simplifies this email by removing duplicate pieces of information.  The standard implementation removes duplicate
recipient emails in the to, cc, and bcc sets.
978767
public void simplify()
  {
    // remove all addresses from the cc and bcc that are in the to address set.
    ccSet.removeAll(toSet);
    bccSet.removeAll(toSet);

    // remove all address from the bcc set that are in the cc set.
    bccSet.removeAll(ccSet);
  }
88933
def clean_email(self):
        
        if get_user_model().objects.filter(email__iexact=self.cleaned_data['email']):
            if userena_settings.USERENA_ACTIVATION_REQUIRED and UserenaSignup.objects.filter(user__email__iexact=self.cleaned_data['email']).exclude(activation_key=userena_settings.USERENA_ACTIVATED):
                raise forms.ValidationError(_('This email is already in use but not confirmed. Please check your email for verification steps.'))
            raise forms.ValidationError(_('This email is already in use. Please supply a different email.'))
        return self.cleaned_data['email']
1362425
public function getCustomersWithDuplicateEmails()
    {
        $customers = $this->customerFactory->create()
            ->getCollection();

        //duplicate emails
        $customers->getSelect()
            ->columns(['emails' => 'COUNT(e.entity_id)'])
            ->group('email')
            ->having('emails > ?', 1);
        return $customers;
    }
475605
def remove(self, transport):
        
        recipients = copy.copy(self.recipients)
        for address, recManager in recipients.items():
            recManager.remove(transport)
            if not len(recManager.transports):
                del self.recipients[address]
1259021
def send_error_email(subject, message, additional_recipients=None):
    
    recipients = _email_recipients(additional_recipients)
    sender = email().sender
    send_email(
        subject=subject,
        message=message,
        sender=sender,
        recipients=recipients
    )
435146
public function removeRecipient ($email)
    {

        // Remove recipients that match the email address

        foreach ($this->_recipients as $key => $val)
        {

            if ($val['email'] == $email)
            {
                unset ($this->_recipients[$key]);
            }

        }

    }
635644
private static Chain removeSeqResHeterogeneity(Chain c) {

		Chain trimmedChain = new ChainImpl();

		ResidueNumber lastResNum = null;

		for (Group g:c.getAtomGroups()) {

			// note we have to deep copy this, otherwise they stay linked and would get altered in addGroup(g)
			ResidueNumber currentResNum = new ResidueNumber(
					g.getResidueNumber().getChainName(),
					g.getResidueNumber().getSeqNum(),
					g.getResidueNumber().getInsCode());

			if (lastResNum == null || !lastResNum.equals(currentResNum) ) {
				trimmedChain.addGroup(g);
			} else {
				logger.debug("Removing seqres group because it seems to be repeated in entity_poly_seq, most likely has hetero='y': "+g);
			}

			lastResNum = currentResNum;

		}
		return trimmedChain;
	}
1059186
def email_message(
        self,
        recipient,  # type: Text
        subject_template,  # type: Text
        body_template,  # type: Text
        sender=None,  # type: Optional[AbstractUser]
        message_class=EmailMessage,
        **kwargs
    ):
        
        from_email = "%s %s <%s>" % (
            sender.first_name,
            sender.last_name,
            email.utils.parseaddr(settings.DEFAULT_FROM_EMAIL)[1],
        )
        reply_to = "%s %s <%s>" % (sender.first_name, sender.last_name, sender.email)

        headers = {"Reply-To": reply_to}
        kwargs.update({"sender": sender, "recipient": recipient})

        subject_template = loader.get_template(subject_template)
        body_template = loader.get_template(body_template)

        subject = subject_template.render(
            kwargs
        ).strip()  # Remove stray newline characters

        body = body_template.render(kwargs)

        return message_class(subject, body, from_email, [recipient], headers=headers)
864145
public function ClearBCCs() {
    foreach($this->bcc as $bcc) {
      unset($this->all_recipients[strtolower($bcc[0])]);
    }
    $this->bcc = array();
  }
1260094
def dedupe(self):
        
        if len(self.pool) == 1:
            logger.debug("Ignore set: only one message found.")
            self.stats['mail_unique'] += 1
            self.stats['set_ignored'] += 1
            return

        try:
            # Fine-grained checks on mail differences.
            self.check_differences()
            # Call the deduplication strategy.
            self.apply_strategy()
        except UnicodeDecodeError as expt:
            self.stats['set_rejected_encoding'] += 1
            logger.warning(
                "Reject set: unparseable mails due to bad encoding.")
            logger.debug(str(expt))
        except SizeDiffAboveThreshold:
            self.stats['set_rejected_size'] += 1
            logger.warning("Reject set: mails are too dissimilar in size.")
        except ContentDiffAboveThreshold:
            self.stats['set_rejected_content'] += 1
            logger.warning("Reject set: mails are too dissimilar in content.")
        else:
            # Count duplicate sets without deletion as skipped.
            if not self.stats['mail_deleted']:
                logger.info("Skip set: no deletion happened.")
                self.stats['set_skipped'] += 1
            else:
                self.stats['set_deduplicated'] += 1
416276
@Override
    public void cleanupTransactionBacklogOnRepair() {
        if (m_isLeader && m_sendToHSIds.length > 0) {
            m_mailbox.send(m_sendToHSIds, new MPBacklogFlushMessage());
        }
        Iterator<Entry<Long, TransactionState>> iter = m_outstandingTxns.entrySet().iterator();
        while (iter.hasNext()) {
            Entry<Long, TransactionState> entry = iter.next();
            TransactionState txnState = entry.getValue();
            if (TxnEgo.getPartitionId(entry.getKey()) == MpInitiator.MP_INIT_PID ) {
                if (txnState.isReadOnly()) {
                    txnState.setDone();
                    m_duplicateCounters.entrySet().removeIf((e) -> e.getKey().m_txnId == entry.getKey());
                    iter.remove();
                }
            }
        }

        // flush all RO transactions out of backlog
        m_pendingTasks.removeMPReadTransactions();
    }
926326
public Email bcc(String... bcc) {
		for (String b : bcc) {
			bcc(new EmailAddress(b));
		}
		return this;
	}
818848
@NonNull
    public EmailIntentBuilder bcc(@NonNull Collection<String> bcc) {
        checkNotNull(bcc);
        for (String email : bcc) {
            checkEmail(email);
        }
        this.bcc.addAll(bcc);

        return this;
    }
375429
def _send(self, email_message):
        """"""
        if not email_message.recipients():
            return False
        from_email = sanitize_address(email_message.from_email, email_message.encoding)

        to_recipients = [sanitize_address(addr, email_message.encoding)
                      for addr in email_message.to]

        try:
            post_data = []
            post_data.append(('to', (",".join(to_recipients)),))
            if email_message.bcc:
                bcc_recipients = [sanitize_address(addr, email_message.encoding) for addr in email_message.bcc]
                post_data.append(('bcc', (",".join(bcc_recipients)),))
            if email_message.cc:
                cc_recipients = [sanitize_address(addr, email_message.encoding) for addr in email_message.cc]
                post_data.append(('cc', (",".join(cc_recipients)),))
            post_data.append(('text', email_message.body,))
            post_data.append(('subject', email_message.subject,))
            post_data.append(('from', from_email,))
            # get our recipient variables if they were passed in
            recipient_variables = email_message.extra_headers.pop('recipient_variables', None)
            if recipient_variables is not None:
                post_data.append(('recipient-variables', recipient_variables, ))

            for name, value in self._map_smtp_headers_to_api_parameters(email_message):
                post_data.append((name, value, ))

            if hasattr(email_message, 'alternatives') and email_message.alternatives:
                for alt in email_message.alternatives:
                    if alt[1] == 'text/html':
                        post_data.append(('html', alt[0],))
                        break

            # Map Reply-To header if present
            try:
                if email_message.reply_to:
                    post_data.append((
                        "h:Reply-To",
                        ", ".join(map(force_text, email_message.reply_to)),
                    ))
            except AttributeError:
                pass

            if email_message.attachments:
                for attachment in email_message.attachments:
                    post_data.append(('attachment', (attachment[0], attachment[1],)))
                content, header = encode_multipart_formdata(post_data)
                headers = {'Content-Type': header}
            else:
                content = post_data
                headers = None

            response = requests.post(self._api_url + "messages",
                    auth=("api", self._access_key),
                    data=content, headers=headers)
        except:
            if not self.fail_silently:
                raise
            return False

        if response.status_code != 200:
            if not self.fail_silently:
                raise MailgunAPIError(response)
            return False

        return True
1358891
public function clear()
    {
        try {
            // Standardize the params array
            $params = array_change_key_case((array)$this->emailConfig, CASE_LOWER);

            // Initialize the mailer
            $this->mailer = new PHPMailer(true);

            // Set any global options in the params
            // All of these are optional, but if we have them, we should fill them.
            $this->_fillParams($params, array('content-type', 'encoding', 'hostname',
                                             'message-id', 'priority', 'smtp-debug',
                                             'sendmail'), false);

            switch ( strtolower($this->emailMode) ) {
            case 'sendmail':
                $this->mailer->IsSendmail();
                break;

            case 'mail':
                $this->mailer->IsMail();
                break;

            case 'smtp':
                $this->mailer->IsSMTP();
                $this->mailer->SMTPAuth = true;
                $this->_requireParams($params, array('host', 'username', 'password'));
                $this->_fillParams($params, array('port', 'smtp-secure', 'timeout'));
                break;

            case 'smtp-no-auth':
                $this->mailer->IsSMTP();
                $this->_requireParams($params, array('host'));
                $this->_fillParams($params, array('port', 'smtp-secure', 'timeout'));
                break;

            case 'qmail':
                $this->mailer->IsQmail();
                break;

            default:
                throw new EmailException("Invalid Email type: '{$this->emailMode}'");
            }

        } catch (phpmailerException $e) {
            throw new EmailException($e->getMessage(), $e->getCode());
        }
        return $this;
    }
1310200
public static Recipient[] toRecipient(EmailAddress[] to) {
		Recipient[] addresses = new Recipient[to.length];
		int i = 0;
		for (EmailAddress t : to) {
			addresses[i++] = new Recipient(t);
		}
		return addresses;
	}
922486
def _remove_duplicates(self):
        
        contained = set()
        for m1, m2 in itertools.combinations(self._max_rects, 2):
            if m1.contains(m2):
                contained.add(m2)
            elif m2.contains(m1):
                contained.add(m1)
        
        # Remove from max_rects
        self._max_rects = [m for m in self._max_rects if m not in contained]