Send mail using the $Sendmail program.

@see    PHPMailer::$Sendmail

@param string $header The message headers
@param string $body   The message body

@throws Exception

@return bool
554047
protected function sendmailSend($header, $body)
    {
        // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
        if (!empty($this->Sender) and self::isShellSafe($this->Sender)) {
            if ('qmail' == $this->Mailer) {
                $sendmailFmt = '%s -f%s';
            } else {
                $sendmailFmt = '%s -oi -f%s -t';
            }
        } else {
            if ('qmail' == $this->Mailer) {
                $sendmailFmt = '%s';
            } else {
                $sendmailFmt = '%s -oi -t';
            }
        }

        $sendmail = sprintf($sendmailFmt, escapeshellcmd($this->Sendmail), $this->Sender);

        if ($this->SingleTo) {
            foreach ($this->SingleToArray as $toAddr) {
                $mail = @popen($sendmail, 'w');
                if (!$mail) {
                    throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
                }
                fwrite($mail, 'To: ' . $toAddr . "\n");
                fwrite($mail, $header);
                fwrite($mail, $body);
                $result = pclose($mail);
                $this->doCallback(
                    ($result == 0),
                    [$toAddr],
                    $this->cc,
                    $this->bcc,
                    $this->Subject,
                    $body,
                    $this->From,
                    []
                );
                if (0 !== $result) {
                    throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
                }
            }
        } else {
            $mail = @popen($sendmail, 'w');
            if (!$mail) {
                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
            }
            fwrite($mail, $header);
            fwrite($mail, $body);
            $result = pclose($mail);
            $this->doCallback(
                ($result == 0),
                $this->to,
                $this->cc,
                $this->bcc,
                $this->Subject,
                $body,
                $this->From,
                []
            );
            if (0 !== $result) {
                throw new Exception($this->lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
            }
        }

        return true;
    }
779531
public function send()
    {
        if ($this->sent()) {
            throw new Exceptions\HeadersAlreadySentException(
                "Headers already sent"
            );
        }

        $this->sent = true;

        foreach ($this as $header) {
            $header->send();
        }

        return $this;
    }
1295082
public function saveMessageInSent($header, $body) {
        return imap_append($this->imap, $this->mailbox . $this->getSent(), $header . "\r\n" . $body . "\r\n", "\\Seen");
    }
1103505
protected function sendBody($body):void
    {
        if (is_resource($body)) {
            fpassthru($body);
            fclose($body);
        }
        else {
            echo $body;
        }
    }
141363
public function post($url, $body, array $headers = [])
    {
        $request = $this->getClient()->createRequest('POST', $url, ['body' => $body]);
        $request->addHeaders($headers);

        return $this->sendRequest($request);
    }
1046274
public function send(string $address, string $subject, ?string $message = null): bool
    {
        // try to get message from global if not passed direct
        if ($message === null) {
            $message = $this->message;
        }

        try {
            if ($message === null) {
                throw new \Exception('Message body is empty!');
            }

            // try to build message and send it
            $message = (new \Swift_Message($subject))
                ->setFrom($this->from)
                ->setTo($address)
                ->setBody($message, 'text/html');
            $this->swift->send($message);
            return true;
        } catch (\Exception $e) {
            if (App::$Debug) {
                App::$Debug->addException($e);
                App::$Debug->addMessage('Send mail failed! Info: ' . $e->getMessage(), 'error');
            }
            return false;
        }
    }
726639
function SendmailSend($header, $body) {
    if ($this->Sender != "")
    $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
    else
    $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));

    if(!@$mail = popen($sendmail, "w"))
    {
      $this->SetError($this->Lang("execute") . $this->Sendmail);
      return false;
    }

    fputs($mail, $header);
    fputs($mail, $body);

    $result = pclose($mail) >> 8 & 0xFF;
    if($result != 0)
    {
      $this->SetError($this->Lang("execute") . $this->Sendmail);
      return false;
    }

    return true;
  }
1194963
public void sendEmail(final List<String> emailList, final String subject, final String body) {
    if (emailList != null && !emailList.isEmpty()) {
      final EmailMessage message = super.createEmailMessage(subject, "text/html", emailList);
      message.setBody(body);
      sendEmail(message, true, "email message " + body);
    }
  }
954105
function sendHeaders()
    {
        if ($this->isHeadersSent())
            throw new \Exception('Headers was sent.');

        $response = $this->getMessageObject();

        // Step 1: Send the "status line".
        $statusLine = sprintf('HTTP/%s %s %s'
            , $response->getProtocolVersion()
            , $response->getStatusCode()
            , $response->getReasonPhrase()
        );
        header($statusLine, true); /* The header replaces a previous similar header. */


        // Step 2: Send the response headers from the headers list.
        foreach ($response->getHeaders() as $name => $values) {
            $responseHeader = sprintf('%s: %s'
                , $name
                , $response->getHeaderLine($name)
            );
            header($responseHeader, false); /* The header doesn't replace a previous similar header. */
        }

        $this->isHeadersSent = true;
        return $this;
    }
964345
public function send($mail)
    {
        $mail = clone $mail;

        try {
            if (!$this->_connection) {
                $this->connect();
            }

            if (($from = $mail->returnPath()) || ($from = $mail->from())) {
                $this->write("MAIL FROM:<" . $from->email() . ">", 250);
            }

            foreach ($mail->recipients() as $recipient) {
                $this->write("RCPT TO:<" . $recipient->email() . ">", [250, 251]);
            }

            $this->write('DATA', 354);
            $this->write(preg_replace('~^\.~m', '..', $mail->toMessage()));
            $this->write('.', 250);

            if (!$this->_persistent) {
                $this->write('QUIT', 221);
                $this->disconnect();
            }
        } catch (NetException $exception) {
            if ($this->_connection) {
                $this->disconnect();
            }
            throw $exception;
        }
    }
680951
protected function printMessage(
        OutputInterface $output,
        $header,
        $body
    ) {
        $message = sprintf(
            '<header>%s</header> <body>%s</body>',
            '[' . $header . ']',
            $body
        );
        $output->writeln($message);
    }
1224160
public static function sendHeader($header, $replace = true)
    {
        // don't send header in CLI mode
        if (!Common::isPhpCliMode() and !headers_sent()) {
            header($header, $replace);
        }
    }
76482
private function sendHeaders()
    {
        foreach ($this->body->getHeaders() as $key => $value) {
            $key = join('-', array_map('ucfirst', explode('-', $key)));
            header(sprintf('%s: %s', $key, $value));
        }
    }
926548
public function send($mailAddress, $username, $subject, $body)
    {
        $subject = $this->translator->trans($subject);
        $body = $this->translator->trans(
            $body,
            ['%username%' => $username]
        );

        $message = $this->messageFactory->create();
        $message
            ->setSubject($subject)
            ->setFrom($this->mailerAddress)
            ->setTo($mailAddress)
            ->setBody($body);

        return $this->mailer->send($message);
    }
149763
protected function sendMail($to, $subject, $body, $headers)
    {
        return mail(
            $to,
            $subject,
            $body,
            $headers
        );
    }
1259374
public function send() : bool
    {
        if (headers_sent()) {
            return false;
        }

        header($this->getStartLine());

        foreach ($this->getHeaders() as $name => $values) {
            foreach ($values as $value) {
                header($name . ': ' . $value, false);
            }
        }

        echo (string) $this->body;

        flush();

        return true;
    }
1063342
public function send()
    {
        if (empty($this->mailer->Subject) || empty($this->mailer->Body)) {
            throw new Exception("Mail subject() and body() can not be empty in order to send mail.");
        }
        if (!$this->getMailer()->send()) {
            Yii::error($this->getError(), __METHOD__);
            return false;
        }
        return true;
    }