Set SMTP transport.

@param  null

@return void
968802
protected function createSmtpTransport()
    {
        $this->smtpTransport = SmtpTransport::newInstance();

        $this->setSmtpConfig($this->smtpTransport, $this->emailConfig['smtp']);
    }
944366
protected function _setMailParams($shop = null)
    {
        $this->_clearMailer();

        if (!$shop) {
            $shop = $this->_getShop();
        }

        $this->setFrom($shop->oxshops__oxorderemail->value, $shop->oxshops__oxname->getRawValue());
        $this->setSmtp($shop);
    }
1137375
protected function transport( $transporter = null )
	{
		if ( !is_null( $transporter ) )
		{
			$transporter = Transporter::create( $transporter );
		}
		else
		{
			$transporter = $this->transporter;
		}
		
		// pass the current mail to the transporter
		$transporter->send( $this );
	}
289472
private function setEntete() {
        $params = "MIME-Version: 1.0\r\n";
        $params .= "Content-type: $this->type; charset=$this->encodage\r\n";
        $from = "From: $this->expediteur_nom <$this->expediteur_email>\r\n";
        $to = "To: $this->destinataire_nom <$this->destinataire_email>\r\n";
        $replay = "Reply-To: $this->expediteur_email\r\n";
        $this->entete = $from . $to . $replay . $params;
    }
547302
public function setSMTPStream ($smtp = FALSE)
    {

        // If an SMTP parameter array has been passed

        if (is_array ($smtp))
        {

            // Set it

            $this->smtp	= $smtp;

        }

        // Else set details

        else
        {

            // SMTP Settings

            $this->smtp		= array (
                'server'		=> defined ('EMAIL_SERVER')? EMAIL_SERVER : NULL,
                'port'			=> defined ('EMAIL_PORT')? EMAIL_PORT : NULL,
                'domain'		=> defined ('EMAIL_DOMAIN')? EMAIL_DOMAIN : NULL,
                'username'		=> defined ('EMAIL_USERNAME')? EMAIL_USERNAME : NULL,
                'password'		=> defined ('EMAIL_PASSWORD')? EMAIL_PASSWORD : NULL
            );

        }

        // Set stream mode

        $this->_useStream	= TRUE;

        // Reset NL

        $this->_nl			= "\r\n";

    }
1000065
private function transport()
    {
        $this->transport = Transport::newInstance($this->smtp->get('host'), $this->smtp->get('port'), $this->smtp->get('encryption'))
            ->setUsername($this->smtp->get('username'))
            ->setPassword($this->smtp->get('password'));

        return $this->transport;
    }
515154
public function sendPacket($pct, $cb = null)
    {
        if (sizeof($this->framesBuffer)) {
            $this->buffer[] = 'a' . $this->toJson($this->framesBuffer);
            $this->framesBuffer = [];
        }
        $this->buffer[] = $pct;
        if ($cb !== null) {
            $this->onWrite->push($cb);
        }
        $this->flush();
    }
736695
public void setPort(int port)
    {
        if (_address == null || _address.getHostName() == null)
            _address= new InetSocketAddress(port);
        else
            _address= new InetSocketAddress(_address.getHostName(), port);
    }
390021
public function setSmtp($shop = null)
    {
        $myConfig = Registry::getConfig();
        $shop = ($shop) ? $shop : $this->_getShop();

        $smtpUrl = $this->_setSmtpProtocol($shop->oxshops__oxsmtp->value);

        if (!$this->_isValidSmtpHost($smtpUrl)) {
            $this->setMailer("mail");

            return;
        }

        $this->setHost($smtpUrl);
        $this->setMailer("smtp");

        if ($shop->oxshops__oxsmtpuser->value) {
            $this->_setSmtpAuthInfo($shop->oxshops__oxsmtpuser->value, $shop->oxshops__oxsmtppwd->value);
        }

        if ($myConfig->getConfigParam('iDebug') == 6) {
            $this->_setSmtpDebug(true);
        }
    }
853937
public function sendEmail($emailFrom, $fromName, $emailTo, $toName = '', $replyTo = null, $subject, $message_html, $message_text = null, $transportConfig = null) {

	    $html = new MimePart($message_html);
	    $html->type = 'text/html';

	    $body = new MimeMessage();
	    
	    if ($message_text!=null){
	        
	        // Add Alternative Email Text Content
    	    $text = new MimePart($message_text);
    	    $text->type = 'text/plain';
    	    
    	    $body->addPart($html,$text);
    	    
	    }else{
	        $body->addPart($html);
	    }
	    
	    $message = new Message();
	    $message->setFrom($emailFrom, $fromName);
	    $message->addTo($emailTo);
	    $message->setSubject($subject);
	    $message->setEncoding('UTF-8');
	    $message->setSender($emailTo, $toName);
	    $message->setBody($body);
	    if ($replyTo!=null){
	        $message->addReplyTo($replyTo);
	    }

        $transport = new Sendmail();

        if(is_array($transportConfig) && $transportConfig) {
            /**
             * Program executes these lines when user passes
             * custom Transport Configuration Options ($transportConfig)
             * to specify their own Mailing Service Provider
             */
            try{
                // Setup SMTP transport using LOGIN authentication
                $transport = new SmtpTransport();
                $options   = new SmtpOptions(array(
                    'name'              => $transportConfig['name'],
                    'host'              => $transportConfig['host'],
                    'connection_class'  => $transportConfig['connectionClass'],
                    'connection_config' => array(
                        'username' => $transportConfig['username'],
                        'password' => $transportConfig['password'],
                        'ssl' => $transportConfig['ssl'],
                    ),
                    'port' => $transportConfig['port'],
                ));
                $transport->setOptions($options);
            }
            catch (\Exception $exception){
                throw new \Exception($exception->getMessage());
            }
        }

        $transport->send($message);
	}
1070186
public function send(): void
    {
        $body = $this->getBody();

        $this->sendCookies();

        switch (true) {
            case 'CLI' === $this->type:
                // no CLI response
                return;
            case null === $body:
            case StatusCode::NO_CONTENT === $this->getStatusCode():
                $response = new EmptyResponse($this->getStatusCode(), $this->getHeaders());
                break;
            case StatusCode::MOVED_PERMANENTLY === $this->getStatusCode():
            case StatusCode::FOUND === $this->getStatusCode():
                $response = new RedirectResponse(
                    $this->getHeader('Location'),
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'JSON' === $this->type:
                // JSON response
                // setup messages
                if (Messages::count()) {
                    $this->setHeader('Bluz-Notify', json_encode(Messages::popAll()));
                }

                // encode body data to JSON
                $response = new JsonResponse(
                    $body,
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'FILE' === $this->type:
                // File attachment
                $response = new AttachmentResponse(
                    $this->body->getData()->get('FILE'),
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'HTML' === $this->type:
            default:
                // HTML response
                $response = new HtmlResponse(
                    (string)$body,
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
        }

        $emitter = new SapiEmitter();
        $emitter->emit($response);
    }
447202
protected function _send()
	{
		$message = $this->build_message(true);

		if(empty($this->config['smtp']['host']) or empty($this->config['smtp']['port']))
		{
			throw new \FuelException('Must supply a SMTP host and port, none given.');
		}

		// Use authentication?
		$authenticate = (empty($this->smtp_connection) and ! empty($this->config['smtp']['username']) and ! empty($this->config['smtp']['password']));

		// Connect
		$this->smtp_connect();

		// Authenticate when needed
		$authenticate and $this->smtp_authenticate();

		// Set from
		$this->smtp_send('MAIL FROM:<'.$this->config['from']['email'].'>', 250);

		foreach(array('to', 'cc', 'bcc') as $list)
		{
			foreach($this->{$list} as $recipient)
			{
				$this->smtp_send('RCPT TO:<'.$recipient['email'].'>', array(250, 251));
			}
		}

		// Prepare for data sending
		$this->smtp_send('DATA', 354);

		$lines = explode($this->config['newline'], $message['header'].preg_replace('/^\./m', '..$1', $message['body']));

		foreach($lines as $line)
		{
			if(substr($line, 0, 1) === '.')
			{
				$line = '.'.$line;
			}

			fputs($this->smtp_connection, $line.$this->config['newline']);
		}

		// Finish the message
		$this->smtp_send('.', 250);

		// Close the connection if we're not using pipelining
		$this->pipelining or $this->smtp_disconnect();

		return true;
	}
333165
public function setTransport($transport)
    {
        if (! ($transport instanceof LibBaseDispatcherResponseTransportAbstract)) {

            if (is_string($transport) && strpos($transport, '.') === false) {
                $identifier = 'com:base.dispatcher.response.transport.'.$transport;
            } else {
                $identifier = $this->getIdentifier($transport);
            }

            register_default(array(
                'identifier' => $identifier,
                'default' => array('ComBaseDispatcherResponseTransportDefault')
            ));

            $transport = $identifier;
        }

        $this->_transport = $transport;

        return $this;
    }
1130743
public function configSMTP() : void
    {
        $this->mailer->isSMTP();
        $this->mailer->SMTPDebug = 0;
        $this->mailer->Host = $this->settings['email']['smtpHost'];
        $this->mailer->Port = $this->settings['email']['smtpPort'];
        $this->mailer->SMTPAuth = true;
        $this->mailer->SMTPSecure = 'ssl';
        $this->mailer->Username = $this->settings['email']['smtpUser'];
        $this->mailer->Password = $this->settings['email']['smtpPass'];
    }
105587
public function send(Zend_Mail $mail)
    {
        $this->_isMultipart = false;
        $this->_mail        = $mail;
        $this->_parts       = $mail->getParts();
        $mime               = $mail->getMime();

        // Build body content
        $this->_buildBody();

        // Determine number of parts and boundary
        $count    = count($this->_parts);
        $boundary = null;
        if ($count < 1) {
            /**
             * @see Zend_Mail_Transport_Exception
             */
            // require_once 'Zend/Mail/Transport/Exception.php';
            throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent');
        }

        if ($count > 1) {
            // Multipart message; create new MIME object and boundary
            $mime     = new Zend_Mime($this->_mail->getMimeBoundary());
            $boundary = $mime->boundary();
        } elseif ($this->_isMultipart) {
            // multipart/alternative -- grab boundary
            $boundary = $this->_parts[0]->boundary;
        }

        // Determine recipients, and prepare headers
        $this->recipients = implode(',', $mail->getRecipients());
        $this->_prepareHeaders($this->_getHeaders($boundary));

        // Create message body
        // This is done so that the same Zend_Mail object can be used in
        // multiple transports
        $message = new Zend_Mime_Message();
        $message->setParts($this->_parts);
        $message->setMime($mime);
        $this->body = $message->generateMessage($this->EOL);

        // Send to transport!
        $this->_sendMail();
    }
941008
protected function setConnectionPassiveMode()
	{
		if (!ftp_pasv($this->getConnection(), $this->passive))
		{
			throw new RuntimeException(sprintf('Could not set passive mode for connection: %s::%s', $this->getHost(), $this->getPort()));
		}
	}
1372822
private function setCC()
    {
        $cc = $this->mailable->get('_cc');

        if (!is_null($cc)) {
            foreach ($cc as $mail) {
                $this->message->setCC($mail);
            }
        }
    }