Remove Recipient
@param string $email Email Address
@return void
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]);
            }

        }

    }
1047000
public function receiveAnEmailToEmail($recipientEmail)
    {
        $message = $this->fetchLastMessage();
        $this->assertEquals($recipientEmail, $message->to_email);
    }
564586
public function setSender($email)
    {
        if ($this->isValidEmail($email) === true) {
            $this->sender = $email;
        } else {
            return false;
        }
    }
1213504
protected function _sendRcpt($email)
    {
        $from = $this->_prepareFromAddress($email);
        $this->_smtpSend($this->_prepareFromCmd(key($from)));

        $emails = $this->_prepareRecipientAddresses($email);
        foreach ($emails as $mail) {
            $this->_smtpSend($this->_prepareRcptCmd($mail));
        }
    }
1050781
public function removeAddresses($addresses)
    {
        $this->setCachedValue(null);
        foreach ((array) $addresses as $address) {
            unset($this->mailboxes[$address]);
        }
    }
279445
public function setReplyTo($email)
    {
        if ($this->isValidEmail($email) === true) {
            $this->reply_to = $email;
        } else {
            return false;
        }
    }
827396
public function removeTranslation(EmailTranslation $translation)
    {
        $this->translations->removeElement($translation);
        $translation->setEmail(null);
    }
683783
public function send(Email $email)
    {
        if (!$this->connected()) {
            $this->_connect();
            $this->_auth();
        } else {
            $this->_smtpSend('RSET');
        }

        $this->_sendRcpt($email);
        $this->_sendData($email);

        if (!$this->_config['keepAlive']) {
            $this->_disconnect();
        }

        return $this->_content;
    }
457356
public function isValidEmail(string $email): bool
    {
        return filter_var(filter_var($email, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL) !== false;
    }
1151789
public function setEmail($email)
	{
		if ( $email == $this->getEmail() ) { return; }

		if( $email !== '' && preg_match('/^.+@[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*$/', $email) !== 1 ) {
			throw new MShop_Exception( sprintf( 'Invalid characters in email address: "%1$s"', $email ) );
		}

		$this->_values['email'] = (string) $email;
		$this->setModified();
	}
1170886
public function deleteAddresses($entity)
    {
        // clear addresses
        if ($entity->getAccountAddresses()) {
            foreach ($entity->getAccountAddresses() as $accountAddresses) {
                $this->em->remove($accountAddresses->getAddress());
                $this->em->remove($accountAddresses);
            }
        }
    }
709192
def remove(self, address):
        
        recipients = []
        if isinstance(address, str):
            address = {address}  # set
        elif isinstance(address, (list, tuple)):
            address = set(address)

        for recipient in self._recipients:
            if recipient.address not in address:
                recipients.append(recipient)
        if len(recipients) != len(self._recipients):
            self._track_changes()
        self._recipients = recipients
1214101
public function clearQueuedAddresses($kind)
    {
        $RecipientsQueue = $this->RecipientsQueue;
        foreach ($RecipientsQueue as $address => $params) {
            if ($params[0] == $kind) {
                unset($this->RecipientsQueue[$address]);
            }
        }
    }
536113
public function deleteEmail( $email_id = null ) {
		if ( ! $email_id ) {
			$this->assertNotEmpty( $this->_current_email, 'The current email is not selected' );
			$email_id = $this->_current_email['id'];
		}

		$this->_send_delete_request( '/messages/' . $email_id );
	}
1269207
public function send($email = 0)
    {

        if ($email instanceof Email) {
            $this->addEmailToOutbox($email);
        }

        $sent_emails = 0;

        foreach ($this->emails as &$email) {
            
            //all email goes to DEBUG_EMAIL if specified
            if (defined("DEBUG_EMAIL")) {
                $email->debug_info = "\n\nDEBUG MODE: Should be sent to: " . $email->to . " when not in debug mode!";
                $email->debug_info .= "\nDEBUG MODE: Should be sent from: " . $email->from . " when not in debug mode!";

                $email->to = \DEBUG_EMAIL;
                $email->from = \DEBUG_EMAIL;

                if (!empty($email->cc)) {
                    $email->debug_info .= "\nDEBUG MODE: Should be be CCed to: "
                        . implode(", ", $email->cc) . " when not in debug mode!";
                    $email->cc = Array();
                }

                if (!empty($email->bcc)) {
                    $email->debug_info .= "\nDEBUG MODE: Should be be BCCed to: "
                        . implode(", ", $email->bcc) . " when not in debug mode!";
                    $email->bcc = Array();
                }

                $email->body .= $email->debug_info;
                if (!empty($email->body_HTML)) {
                    $email->body_HTML .= nl2br($email->debug_info);
                }
            }
            $email->to = $email->to ? $email->to : null;
            $email->constructMultipartMessage();
            
            //sanitize sender params
            if(preg_match("~<(.*?)>~", $email->from, $match)){
                $sender = $match[1];
            } else {
                $sender = $email->from;
            }
      
            $sender = filter_var($sender, FILTER_SANITIZE_EMAIL);
            $params = sprintf('-f%s', escapeshellcmd($sender));
    
            if (mail($email->to, $email->subject, $email->body, $email->_header_text, $params)) {

                $email->sent = 1;
                $sent_emails++;

                $this->logEmail($email, true);
            } else {
                $this->logEmail($email, false);
            }
        }

        $emails_cnt = count($this->emails);

        $this->emails = Array();

        if ($sent_emails == $emails_cnt) {
            return true;
        } else {
            return false;
        }
    }
742171
public function validateEmail($email)
    {
        $person = $this->getService('repos:people.person')->find(array('email' => $email));

        if ($person) {
            $this->setMessage('Email is already in use');
            return false;
        }

        return true;
    }
259802
public function setCc($email)
    {
        if (is_string($email)) {
            $email = [ $email ];
        }

        if (!is_array($email)) {
            throw new InvalidArgumentException(
                'Must be an array of CC recipients.'
            );
        }

        $this->cc = [];

        // At this point, `$email` can be an _email array_ or an _array of emails_...
        if (isset($email['email'])) {
            // Means we're not dealing with multiple emails
            $this->addCc($email);
        } else {
            foreach ($email as $recipient) {
                $this->addCc($recipient);
            }
        }

        return $this;
    }