Swift_Transport_AbstractSmtpTransport::start PHP Method

start() public method

Start the SMTP connection.
public start ( )
    public function start()
    {
        if (!$this->_started) {
            if ($evt = $this->_eventDispatcher->createTransportChangeEvent($this)) {
                $this->_eventDispatcher->dispatchEvent($evt, 'beforeTransportStarted');
                if ($evt->bubbleCancelled()) {
                    return;
                }
            }
            try {
                $this->_buffer->initialize($this->_getBufferParams());
            } catch (Swift_TransportException $e) {
                $this->_throwException($e);
            }
            $this->_readGreeting();
            $this->_doHeloCommand();
            if ($evt) {
                $this->_eventDispatcher->dispatchEvent($evt, 'transportStarted');
            }
            $this->_started = true;
        }
    }

Usage Example

 /**
  * Start the standalone SMTP session if running in -bs mode.
  */
 public function start()
 {
   if (false !== strpos($this->getCommand(), ' -bs'))
   {
     parent::start();
   }
 }