Sends an \Tx_Oelib_Mail object (one separate message per recipient).

@param \Tx_Oelib_Mail $email the \Tx_Oelib_Mail object to send

@return void

@throws \InvalidArgumentException
968204
public function send(\Tx_Oelib_Mail $email)
    {
        if (!$email->hasSender()) {
            throw new \InvalidArgumentException('$email must have a sender set.', 1331318718);
        }
        $this->validateEmailAddress($email->getSender()->getEmailAddress(), 'From:');
        if ($email->getSubject() === '') {
            throw new \InvalidArgumentException('The e-mail subject must not be empty.', 1409410879);
        }
        if (!$email->hasMessage()) {
            throw new \InvalidArgumentException('The e-mail message must not be empty.', 1409410886);
        }
        $recipients = $email->getRecipients();
        if (empty($recipients)) {
            throw new \InvalidArgumentException('The e-mail must have at least one recipient.', 1409410886);
        }
        foreach ($recipients as $recipient) {
            $this->validateEmailAddress($recipient->getEmailAddress(), 'To:');
        }

        /** @var MailMessage $swiftMail */
        $swiftMail = GeneralUtility::makeInstance(MailMessage::class);
        $swiftMail->setSubject($email->getSubject());

        $sender = $email->getSender();
        $swiftMail->setFrom([$sender->getEmailAddress() => $sender->getName()]);
        if ($email->hasReplyTo()) {
            $replyTo = $email->getReplyTo();
            $swiftMail->setReplyTo([$replyTo->getEmailAddress() => $replyTo->getName()]);
        }
        $swiftMail->setCharset('utf-8');

        $returnPath = $email->getReturnPath();
        if ($returnPath !== '') {
            $swiftMail->setReturnPath($returnPath);
        }

        if ($email->hasMessage()) {
            $swiftMail->setBody($this->formatEmailBody($email->getMessage()));
        }
        if ($email->hasHTMLMessage()) {
            $swiftMail->addPart($email->getHTMLMessage(), 'text/html');
        }

        /** @var \Tx_Oelib_Attachment $attachment */
        foreach ($email->getAttachments() as $attachment) {
            if (($attachment->getFileName() !== '') && ($attachment->getContent() === '')) {
                $swiftAttachment =
                    \Swift_Attachment::fromPath($attachment->getFileName(), $attachment->getContentType());
            } else {
                $fileName = $attachment->getFileName() !== '' ? $attachment->getFileName() : null;
                $swiftAttachment = \Swift_Attachment::newInstance(
                    $attachment->getContent(),
                    $fileName,
                    $attachment->getContentType()
                );
            }

            $swiftMail->attach($swiftAttachment);
        }

        foreach ($email->getRecipients() as $recipient) {
            $swiftMail->setTo([$recipient->getEmailAddress() => $recipient->getName()]);
            $this->sendSwiftMail($swiftMail);
        }
    }
82936
public static function send(IMailMessage $mail) {
        $success = TRUE;
        try {
            mail($mail->getTo(), $mail->getSubject(), $mail->getBody(), $mail->getHeaders());
        } catch (Exception $exc) {
            $success = FALSE;
        }
        return $success;
    }
414827
public function setTo($email)
    {
        if (is_string($email)) {
            $email = [ $email ];
        }

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

        $this->to = [];

        // 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->addTo($email);
        } else {
            foreach ($email as $recipient) {
                $this->addTo($recipient);
            }
        }

        return $this;
    }
1210972
public function setEmail($email)
    {
        if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $this->_options['email'] = $email;
            $this->_options['hash'] = strtolower(md5(trim($this->_options['email'])));
        } else {
            throw new \Exception('The email is in an invalid format!');
        }

        return $this;
    }
699800
public function set_sender($email)
        {
            $parts = $this->parse_email($email);
            $this->from_user = $parts[0];
            $this->from_domain = $parts[1];
        }
19237
public function setEmail($email)
    {
        if (!is_bool($email)) {
            throw new \InvalidArgumentException('The attribute email on the class Attribute has to be boolean (' . gettype($email) . ('object' === gettype($email) ? ' ' . get_class($email) : '') . ' given).');
        }

        $this->email = $email;

        return $this;
    }
676290
public function setEmail($email)
    {
        if (!is_string($email)) {
            $email = strval($email);
        }

        $this->email = $email;
    }
1256381
protected function _sendData($email)
    {
        $this->_smtpSend('DATA', '354');

        $headers = $this->_headersToString($this->_prepareMessageHeaders($email));
        $message = $this->_prepareMessage($email);

        $this->_smtpSend($headers . "\r\n\r\n" . $message . "\r\n\r\n\r\n.");
        $this->_content = ['headers' => $headers, 'message' => $message];
    }
1111998
protected static function validateEmailAddress($email) {
		if (empty($email)) {
			throw new InvalidEmailException();
		}

		$email = \trim($email);

		if (!\filter_var($email, \FILTER_VALIDATE_EMAIL)) {
			throw new InvalidEmailException();
		}

		return $email;
	}
451268
public function addBCC( $email )
    {
        if ( is_array( $email ) )
        {
            $this->mailer->addBCC( $email[ 'email' ], $email[ 'name' ] );
        }
        else
        {
            $this->mailer->addBCC( $email );
        }
    }
1373601
public function send(Message $mail) {
		$mails = array();
		if($this->sessionSection->offsetExists('sentMessages')) {
			$mails = $this->sessionSection->sentMessages;
		}

		if (count($mails) === $this->limit) {
			array_pop($mails);
		}

		// get message with generated html instead of set FileTemplate etc
		$reflectionMethod = $mail->getReflection()->getMethod('build');
		$reflectionMethod->setAccessible(TRUE);
		$builtMail = $reflectionMethod->invoke($mail);

		array_unshift($mails, $builtMail);

		$this->sessionSection->sentMessages = $mails;
	}
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));
        }
    }
531498
public function setSenderEmail($senderEmail)
    {
        if ($this->sender == null) {
            $this->sender = new PagSeguroSender();
        }
        $this->sender->setEmail($senderEmail);
    }
285293
public function setSenderEmailAddress($email)
    {
        if (!$this->validateHeaderFieldValue($email)) {
            throw new EmailValidationException(__('Sender Email Address can not contain carriage return or newlines.'));
        }

        $this->_sender_email_address = $email;
    }
7719
public function add(string $email, string $name = null): void
    {
        $recipient = $this->make();
        $recipient->email = $email;
        if ($name !== null) {
            $recipient->name = $name;
        }
        $this->set($recipient);
    }
710807
public function sendMail(Mail $mail) {
		$sender = $mail->getSender();
		if (!$sender instanceof MailAddress) {
			throw new SmtpException('no sender found on mail');
		}
		$this->mail($sender->getEmail());
		
		foreach ($mail->getRecipients() as $address) {
			$address instanceof MailAddress;
			// @todo: catch errors
			$this->recipient($address->getEmail());
		}
		
		$this->data($mail->getData());
	}
1119956
public function send(Email $email) {
		if (!empty($this->_config['queue'])) {
			$this->_config = $this->_config['queue'] + $this->_config;
			$email->setConfig((array)$this->_config['queue'] + ['queue' => []]);
			unset($this->_config['queue']);
		}

		$transport = $this->_config['transport'];
		$email->setTransport($transport);

		/** @var \Queue\Model\Table\QueuedJobsTable $QueuedJobs */
		$QueuedJobs = TableRegistry::getTableLocator()->get('Queue.QueuedJobs');
		$result = $QueuedJobs->createJob('Email', ['transport' => $transport, 'settings' => $email]);
		$result['headers'] = '';
		$result['message'] = '';

		return $result->toArray();
	}