Sends the HELO command to the smtp server.
This makes sure that we and the server are in
the same known state.

Implements from rfc 821: HELO <SP> <domain> <CRLF>

SMTP CODE SUCCESS: 250
SMTP CODE ERROR  : 500, 501, 504, 421
@access public
@return bool
6289
function Hello($host="") {
    $this->error = null; # so no confusion is caused

    if(!$this->connected()) {
      $this->error = array(
      "error" => "Called Hello() without being connected");
      return false;
    }

    # if a hostname for the HELO wasn't specified determine
    # a suitable one to send
    if(empty($host)) {
      # we need to determine some sort of appopiate default
      # to send to the server
      $host = "localhost";
    }

    // Send extended hello first (RFC 2821)
    if(!$this->SendHello("EHLO", $host))
    {
      if(!$this->SendHello("HELO", $host))
      return false;
    }

    return true;
  }
1026596
public function send()
  {
    if (!array_key_exists($this->code, Status::CODE)) return false;

    if ($this->with !== null || $this->with !== []) {
      $data = array_merge(isset($_SESSION['application']['with']) ? $_SESSION['application']['with'] : [], $this->with);
      $_SESSION['application']['with'] = $data;
    }

    header('Location: ' . $this->url);
    exit;
  }
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;
    }
74722
public function send()
    {
        $args = func_get_args();
        if (count($args) > 1) {
            $message = call_user_func_array('sprintf', $args);
        } else {
            $message = $args[0];
        }
        $this->response->send($message);
    }
1121088
protected function _auth()
    {
        if ($this->_helo == false) {
            throw new SMTPException(__('Must call EHLO (or HELO) before calling AUTH'));
        } elseif ($this->_auth !== false) {
            throw new SMTPException(__('Can not call AUTH again.'));
        }

        $this->_send('AUTH LOGIN');
        $this->_expect(334);
        $this->_send(base64_encode($this->_user));
        $this->_expect(334);
        $this->_send(base64_encode($this->_pass));
        $this->_expect(235);
        $this->_auth = true;
    }
1021465
public function send()
    {
        $this->hash();

        if ($data = $this->handle('beforeExecuteReturn')) {
            return $data;
        }

        if (!empty($this->payload)) {
            $this->serialized_payload = $this->handle('serialize', $this->payload);
        }

        $this->uri = $this->formatEndpoint();

        $this->handle('beforeExecute');

        $exception = false;
        $res       = null;

        try {
            $client = new Client();

            $res = $client->request(
                $this->method,
                $this->uri,
                $this->headers + $this->formatBody() + $this->options
            );

        } catch (Exception $e) {
            $exception = $e;
        }

        if (is_bool($exception) && $res instanceof Response) {
            $body = $this->handle('parse', $res->getBody());

            if ($data = $this->handle('afterExecuteReturn', $body)) {
                return $data;
            }

            $this->handle('afterExecute', $body);

            return $body;
        }

        $msg = null;

        if ($exception instanceof Exception) {
            $msg = $exception->getMessage();

            if ($exception instanceof RequestException) {
                $msg = $exception->getRequest();

                if ($exception->hasResponse()) {
                    $msg = $exception->getResponse()->getBody()->getContents();
                }
            }
        }

        return $this->handle('error', $msg, ['exception' => $exception instanceof Exception ? $exception : null]);
    }
701979
protected function _send()
	{
		// Build the message
		$message = $this->build_message();

		// Open a connection
		$return_path = ($this->config['return_path'] !== false) ? $this->config['return_path'] : $this->config['from']['email'];
		$handle = @popen($this->config['sendmail_path'] . " -oi -f ".$return_path." -t", 'w');

		// No connection?
		if(! is_resource($handle))
		{
			throw new \SendmailConnectionException('Could not open a sendmail connection at: '.$this->config['sendmail_path']);
		}

		// Send the headers
		fputs($handle, $message['header']);

		// Send the body
		fputs($handle, $message['body']);

		if(pclose($handle) === -1)
		{
			throw new \SendmailFailedException('Failed sending email through sendmail.');
		}

		return true;
	}
1155894
public function send()
    {
        $oxEMail = oxNew(\OxidEsales\Eshop\Core\Email::class);
        $blSend = $oxEMail->sendNewsletterMail($this, $this->_oUser, $this->oxnewsletter__oxsubject->value);

        return $blSend;
    }
526779
function SmtpConnect() {
    if($this->smtp == NULL) { $this->smtp = new SMTP(); }

    //Added for Gmail support CER
    $this->smtp->Protocol = $this->Protocol;

    $this->smtp->do_debug = $this->SMTPDebug;
    $hosts = explode(";", $this->Host);
    $index = 0;
    $connection = ($this->smtp->Connected());

    // Retry while there is no connection
    while($index < count($hosts) && $connection == false)
    {
      if(strstr($hosts[$index], ":"))
      list($host, $port) = explode(":", $hosts[$index]);
      else
      {
        $host = $hosts[$index];
        $port = $this->Port;
      }

      if($this->smtp->Connect($host, $port, $this->Timeout))
      {
        if ($this->Helo != '')
        $this->smtp->Hello($this->Helo);
        else
        $this->smtp->Hello($this->ServerHostname());

        if($this->SMTPAuth)
        {
          if(!$this->smtp->Authenticate($this->Username,
          $this->Password))
          {
            $this->SetError($this->Lang("authenticate"));
            $this->smtp->Reset();
            $connection = false;
          }
        }
        $connection = true;
      }
      $index++;
    }
    if(!$connection)
    $this->SetError($this->Lang("connect_host"));

    return $connection;
  }
25537
public function nextMail()
    {
        if ( $this->currentMessage === null )
        {
            $this->currentMessage = reset( $this->messages );
        }
        else
        {
            $this->currentMessage = next( $this->messages );
        }
        if ( $this->currentMessage !== false )
        {
            $this->connection->sendData( "RETR {$this->currentMessage}" );
            $response = $this->connection->getLine();
            if ( strpos( $response, "+OK" ) === 0 )
            {
                $this->hasMoreMailData = true;
                return true;
            }
            else
            {
                throw new ezcMailTransportException( "The POP3 server sent a negative reply when requesting mail." );
            }
        }
        return false;
    }
554782
public function Send()
    {
        try {
            if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
                throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL);
            }

            // Set whether the message is multipart/alternative
            if (!empty($this->AltBody)) {
                $this->ContentType = 'multipart/alternative';
            }

            $this->error_count = 0; // reset errors
            $this->SetMessageType();
            $header = $this->CreateHeader();
            $body   = $this->CreateBody();

            if (empty($this->Body)) {
                throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
            }

            // Choose the mailer and send through it
            switch ($this->Mailer) {
                case 'smtp':
                    return $this->SmtpSend($header, $body);
                    break;
                case 'sendmail':
                    return $this->SendmailSend($header, $body);
                    break;
                case 'mail':
                    break;
                default:
                    return $this->MailSend($header, $body);
            }
        } catch (phpmailerException $e) {
            $this->SetError($e->getMessage());
            if ($this->exceptions) {
                throw $e;
            }
            echo $e->getMessage() . "\n";
            return false;
        }
    }
1029541
public function check()
    {
        $f = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout);
        if (!$f) {
            return [
                EnvironmentCheck::ERROR,
                sprintf("Couldn't connect to SMTP on %s:%s (Error: %s %s)", $this->host, $this->port, $errno, $errstr)
            ];
        }

        fwrite($f, "HELO its_me\r\n");
        $response = fread($f, 26);
        if (substr($response, 0, 3) != '220') {
            return [
                EnvironmentCheck::ERROR,
                sprintf('Invalid mail server response: %s', $response)
            ];
        }

        return [EnvironmentCheck::OK, ''];
    }
340258
public function _sendMail()
    {
        // If sending multiple messages per session use existing adapter
        if (!($this->_connection instanceof Zend_Mail_Protocol_Smtp)) {
            // Check if authentication is required and determine required class
            $connectionClass = 'Zend_Mail_Protocol_Smtp';
            if ($this->_auth) {
                $connectionClass .= '_Auth_' . ucwords($this->_auth);
            }
            if (!class_exists($connectionClass)) {
                // require_once 'Zend/Loader.php';
                Zend_Loader::loadClass($connectionClass);
            }
            $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config));
            $this->_connection->connect();
            $this->_connection->helo($this->_name);
        } else {
            // Reset connection to ensure reliable transaction
            $this->_connection->rset();
        }

        // Set sender email address
        $this->_connection->mail($this->_mail->getReturnPath());

        // Set recipient forward paths
        foreach ($this->_mail->getRecipients() as $recipient) {
            $this->_connection->rcpt($recipient);
        }

        // Issue DATA command to client
        $this->_connection->data($this->header . Zend_Mime::LINEEND . $this->body);
    }
1126079
public function send()
    {
        // Check if headers are sent already.
        if (headers_sent() === false) {

            // Determine reason phrase
            if ($this->reasonPhrase === null) {
                $this->reasonPhrase = self::$messages[$this->statusCode];
            }

            // Send status code.
            header(sprintf('%s %s', $this->protocolVersion, $this->reasonPhrase), true, $this->statusCode);

            // Send headers.
            foreach ($this->headers as $header => $value) {
                header(sprintf('%s: %s', $header, $value), true, $this->statusCode);
            }

            // Send cookies.
            foreach ($this->cookies as $cookie) {
                setcookie($cookie['name'], $cookie['value'], $cookie['expire'],
                    $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
            }

            // Send body.
            echo $this->body;
        }

        return $this;
    }
291710
private function Smtp_Ok()
    {
        $_res = str_replace("\r\n", '', fgets($this->Smtp_Socket, 512));
        if ( ! preg_match('/^[23]/', $_res))
        {
            fputs($this->Smtp_Socket, "QUIT\r\n");
            fgets($this->Smtp_Socket, 512);
            return FALSE;
        }
        return TRUE;
    }
424768
public function send()
    {
        // Send headers
        if (headers_sent() === false) {
            if (strpos(PHP_SAPI, 'cgi') === 0) {
                header(sprintf('Status: %s', $this->getReasonPhrase()));
            } else {
                header(sprintf('%s %s', $this->getProtocolVersion(), $this->getReasonPhrase()));
            }

            foreach ($this->headers as $name => $value) {
                foreach ($value as $hVal) {
                    header("$name: $hVal", false);
                }
            }
        }

        // Send body
        $this->body->seek(0);
        while ($this->body->feof() === false) {
            echo $this->body->read(1024);
        }

        return $this;
    }
843699
public function Connected() {
    if(!empty($this->smtp_conn)) {
      $sock_status = socket_get_status($this->smtp_conn);
      if($sock_status["eof"]) {
        // the socket is valid but we are not connected
        if($this->do_debug >= 1) {
            $this->edebug("SMTP -> NOTICE:" . $this->CRLF . "EOF caught while checking if connected");
        }
        $this->Close();
        return false;
      }
      return true; // everything looks good
    }
    return false;
  }