Sends mail using the PHP mail() function.
@param string $header The message headers
@param string $body The message body
@access protected
@return bool
502598
protected function MailSend($header, $body) {
    $toArr = array();
    foreach($this->to as $t) {
      $toArr[] = $this->AddrFormat($t);
    }
    $to = implode(', ', $toArr);

    if (empty($this->Sender)) {
      $params = "-oi ";
    } else {
      $params = sprintf("-oi -f%s", $this->Sender);
    }
    if ($this->Sender != '' and !ini_get('safe_mode')) {
      $old_from = ini_get('sendmail_from');
      ini_set('sendmail_from', $this->Sender);
    }
    if ($this->SingleTo === true && count($toArr) > 1) {
      foreach ($toArr as $key => $val) {
        $rt = $this->mail_passthru($val, $this->Subject, $body, $header, $params);
        // implement call back function if it exists
        $isSent = ($rt == 1) ? 1 : 0;
        $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
      }
    } else {
      $rt = $this->mail_passthru($to, $this->Subject, $body, $header, $params);
      // implement call back function if it exists
      $isSent = ($rt == 1) ? 1 : 0;
      $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
    }
    if (isset($old_from)) {
      ini_set('sendmail_from', $old_from);
    }
    if(!$rt) {
      throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
    }
    return true;
  }
1358742
public function send($email, $name = null, $subject, $body, $attachment = null, $bcc = null)
    {
        $this->phpMailer->isSMTP();
        $this->phpMailer->Host = $this->app->config->getMail('host');
        $this->phpMailer->SMTPAuth = true;
        $this->phpMailer->Username = $this->app->config->getMail('username');
        $this->phpMailer->Password = $this->app->config->getMail('password');
        $this->phpMailer->SMTPSecure = $this->app->config->getMail('encryption');
        $this->phpMailer->Port = $this->app->config->getMail('port');

        $this->phpMailer->From = $this->app->config->getMail('from.email');
        $this->phpMailer->FromName = $this->app->config->getMail('from.name');

        $this->phpMailer->addAddress($email, $name);

        $this->phpMailer->addReplyTo(
                                $this->app->config->getMail('reply.email'),
                                $this->app->config->getMail('mail.reply.name')
                            );

        $this->phpMailer->addBCC($bcc);

        $this->phpMailer->addAttachment($attachment);

        $this->phpMailer->isHTML(true);

        $this->phpMailer->Subject = $subject;
        $this->phpMailer->Body    = $body;

        /**
         * If log set to true
         * then log email
         */
        if ($this->app->config->getMail('log') == true) return $this->logEmail($body);

        /**
         * If log set to false
         * then send email
         */
        if ( $this->app->config->getMail('log') !== true)
        {
            try
            {
                set_time_limit(0);

                if( ! $this->phpMailer->send()) throw new MailerException($this->phpMailer->ErrorInfo);

                else return true;
            }
            catch(phpmailerException  $e)
            {
                throw new MailerException($e->errorMessage());
            }
        }
    }
20656
public function send(array $body = null)
    {
        $json = $this->createJsonBody($body);
        $signature = $this->createSignature($json);
        
        $headers = $options = [];
        $headers["User-Agent"] = self::prepareUserAgent();
        
        if ($body) {
            $headers["Content-Type"] = "application/json";
            $headers["Content-Length"] = strlen($json);
            $options["body"] = $json;
        }
        
        $options["headers"] = $this->prepareHeaders($signature, $headers);
        
        try {
            $this->httpClient = new Client(
                [
                    "base_uri" => $this->host,
                    "timeout" => self::TIMEOUT
                ]
            );
            
            return new Result(
                $this->httpClient->request(
                    $this->method, 
                    $this->endpoint, 
                    $options
                )
            );
        } catch (TransferException $e) {
            throw new EndpointException($e->getMessage(), $e->getCode(), $e);
        }
    }
886165
protected function send(
        ResponseInterface $response,
        string $body): ResponseInterface
    {
        if (!$body) {
            $response = $this->sendErrorDocument($response);
        }
        unset($this->errorDocument);
        $response = $response->withHeader(
            Response::HEADER_CONTENT_LENGTH,
            (string) strlen($body));
        header(Response::PROTOCOL
             . $response->getProtocolVersion() . " "
             . $response->getStatusCode() . " "
             . $response->getReasonPhrase());
        foreach ($response->getHeaders() as $key => $value) {
            header($key . ": " . implode("; ", $value));
        }
        $response->getBody()->write($body);
        return $response;
    }
448217
public function publish($body, array $headers = [], $exchange = '', $routingKey = '', $mandatory = false, $immediate = false)
    {
        return $this->getClient()->publish($this->getChannelId(), $body, $headers, $exchange, $routingKey, $mandatory, $immediate);
    }
1168949
protected function mailSend($header, $body)
    {
        $toArr = [];
        foreach ($this->to as $toaddr) {
            $toArr[] = $this->addrFormat($toaddr);
        }
        $to = implode(', ', $toArr);

        $params = null;
        //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
        if (!empty($this->Sender) and static::validateAddress($this->Sender)) {
            //A space after `-f` is optional, but there is a long history of its presence
            //causing problems, so we don't use one
            //Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html
            //Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html
            //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html
            //Example problem: https://www.drupal.org/node/1057954
            // CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped.
            if (self::isShellSafe($this->Sender)) {
                $params = sprintf('-f%s', $this->Sender);
            }
        }
        if (!empty($this->Sender) and static::validateAddress($this->Sender)) {
            $old_from = ini_get('sendmail_from');
            ini_set('sendmail_from', $this->Sender);
        }
        $result = false;
        if ($this->SingleTo and count($toArr) > 1) {
            foreach ($toArr as $toAddr) {
                $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
                $this->doCallback($result, [$toAddr], $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
            }
        } else {
            $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);
            $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);
        }
        if (isset($old_from)) {
            ini_set('sendmail_from', $old_from);
        }
        if (!$result) {
            throw new Exception($this->lang('instantiate'), self::STOP_CRITICAL);
        }

        return true;
    }
1012497
public function send($to, $subject, $body, $headers)
    {
        return mail(
            $to,
            $subject,
            $body,
            $headers
        );
    }
149257
protected function sendRequest($headers, $body)
    {
        $request = new Request(
            'POST',
            $this->ionicPushEndPoint,
            $headers,
            $body
        );
        $client = new Client();

        try {
            $response = $client->send($request);
            return $response;
        } catch (ClientException $e) {
            switch ($e->getCode()) {
                case 401:
                case 403: {
                    throw new PermissionDeniedException(
                        "Permission denied sending push", $e->getCode(), $e
                    );
                }
                case 400: {
                    throw new BadRequestException(
                        "Bad request sending push", 400, $e
                    );
                }
            }
        } catch (\Exception $e) {
            throw new RequestException(
                "An error occurred when sending push request with message: {$e->getMessage()}",
                $e->getCode(),
                $e
            );
        }

        return null;
    }
215610
protected function send($method, $endpoint = '', array $headers = null, $body = null)
    {
        $this->lastResponse = null;
        $url = $this->baseUrl . $endpoint;
        $options = ['headers' => \array_merge($this->defaultHeaders, $headers)];

        if (!empty($body)) {
            $options['body'] = $body;
        }

        $this->lastRequest = $this->httpClient->request(
            $method,
            $url,
            $options
        );

        try {
            $this->lastResponse = $this->httpClient->send($this->lastRequest);
        } catch (\Exception $error) {
            throw new HttpServiceException(
                HttpServiceException::BAD_SERVICE_REQUEST,
                [$error->getMessage()]
            );
        }

        return $this->lastResponse;
    }
311157
public function post($uri, array $headers = [], $body = null)
    {
        return $this->send('POST', $uri, $headers, $body);
    }
162046
public function publish($body, array $headers = [], $exchange = '', $routingKey = '', $mandatory = false, $immediate = false)
    {
        $response = $this->publishImpl($body, $headers, $exchange, $routingKey, $mandatory, $immediate);

        if ($this->mode === ChannelModeEnum::CONFIRM) {
            if ($response instanceof PromiseInterface) {
                return $response->then(function () {
                    return ++$this->deliveryTag;
                });
            } else {
                return ++$this->deliveryTag;
            }
        } else {
            return $response;
        }
    }
836038
public function send( string$body=null ):Response
	{
		$this->justSend($body);

		return new Response( $this, $this->handle );
	}
746228
public function patch($url, $headers = [], $body = null)
    {
        return $this->send(Method::PATCH, $url, $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;
    }
951265
function smtp_send($helo, $from, $to, $header, $body = "")
    {
        if (!$this->smtp_putcmd("HELO", $helo)) {
            return $this->smtp_error("sending HELO command");
        }
        #auth
        if ($this->auth) {
            if (!$this->smtp_putcmd("AUTH LOGIN", base64_encode($this->user))) {
                return $this->smtp_error("sending HELO command");
            }

            if (!$this->smtp_putcmd("", base64_encode($this->pass))) {
                return $this->smtp_error("sending HELO command");
            }
        }
        if (!$this->smtp_putcmd("MAIL", "FROM:<" . $from . ">")) {
            return $this->smtp_error("sending MAIL FROM command");
        }

        if (!$this->smtp_putcmd("RCPT", "TO:<" . $to . ">")) {
            return $this->smtp_error("sending RCPT TO command");
        }

        if (!$this->smtp_putcmd("DATA")) {
            return $this->smtp_error("sending DATA command");
        }

        if (!$this->smtp_message($header, $body)) {
            return $this->smtp_error("sending message");
        }

        if (!$this->smtp_eom()) {
            return $this->smtp_error("sending <CR><LF>.<CR><LF> [EOM]");
        }

        if (!$this->smtp_putcmd("QUIT")) {
            return $this->smtp_error("sending QUIT command");
        }
        return TRUE;
    }
60224
protected function MailSend($header, $body)
    {
        $toArr = array();
        foreach ($this->to as $t) {
            $toArr[] = $this->AddrFormat($t);
        }
        $to = implode(', ', $toArr);

        if (empty($this->Sender)) {
            $params = "-oi -f %s";
        } else {
            $params = sprintf("-oi -f %s", $this->Sender);
        }
        if ($this->Sender != '' and !ini_get('safe_mode')) {
            $old_from = ini_get('sendmail_from');
            ini_set('sendmail_from', $this->Sender);
            if ($this->SingleTo === true && count($toArr) > 1) {
                foreach ($toArr as $key => $val) {
                    $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
                    // implement call back function if it exists
                    $isSent = ($rt == 1) ? 1 : 0;
                    $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
                }
            } else {
                $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
                // implement call back function if it exists
                $isSent = ($rt == 1) ? 1 : 0;
                $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
            }
        } else {
            if ($this->SingleTo === true && count($toArr) > 1) {
                foreach ($toArr as $key => $val) {
                    $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
                    // implement call back function if it exists
                    $isSent = ($rt == 1) ? 1 : 0;
                    $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body);
                }
            } else {
                $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
                // implement call back function if it exists
                $isSent = ($rt == 1) ? 1 : 0;
                $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);
            }
        }
        if (isset($old_from)) {
            ini_set('sendmail_from', $old_from);
        }
        if (!$rt) {
            throw new phpmailerException($this->Lang('instantiate'), self::STOP_CRITICAL);
        }
        return true;
    }
1341661
protected function sendBody(Stream $body)
    {
        // I don't trust that this will be at the beginning of the stream, so reset.
        $body->rewind();

        // writing to an arbitrary stream.
        // @todo Use stream operations to make this more robust and allow
        $bytes = 0;
        if ($bytes = $body->getSize() && $bytes < 500) {
            print $body->getContents();

        } else {
            while (!$body->eof()) {
                $data = $body->read(1024);
                print $data;
            }
        }
    }