Jyxo\Mail\Sender::sendByMail PHP Метод

sendByMail() приватный Метод

Sends an email using the mail() function.
private sendByMail ( )
    private function sendByMail()
    {
        $recipients = '';
        $iterator = new \ArrayIterator($this->email->to);
        while ($iterator->valid()) {
            $recipients .= $this->formatAddress($iterator->current());
            $iterator->next();
            if ($iterator->valid()) {
                $recipients .= ', ';
            }
        }
        $subject = $this->changeCharset($this->clearHeaderValue($this->email->subject));
        if (!mail($recipients, $this->encodeHeader($subject), $this->createdBody, $this->getHeader(['To', 'Subject']))) {
            throw new Sender\Exception('Could not send the message.');
        }
    }