Swift_Transport_EsmtpTransport::setTimeout PHP Method

setTimeout() public method

Set the connection timeout.
public setTimeout ( integer $timeout ) : Swift_Transport_EsmtpTransport
$timeout integer seconds
return Swift_Transport_EsmtpTransport
    public function setTimeout($timeout)
    {
        $this->params['timeout'] = (int) $timeout;
        $this->buffer->setParam('timeout', (int) $timeout);
        return $this;
    }

Usage Example

 /**
  * Gets the 'swiftmailer.mailer.default.transport.real' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return Swift_Transport_EsmtpTransport A Swift_Transport_EsmtpTransport instance.
  */
 protected function getSwiftmailer_Mailer_Default_Transport_RealService()
 {
     $a = new \Swift_Transport_Esmtp_AuthHandler(array(0 => $this->get('a27c38881fcb60cd7efcfc1aaed4ab1403ae65ca418be97b8f25c018e821ef41_1'), 1 => $this->get('a27c38881fcb60cd7efcfc1aaed4ab1403ae65ca418be97b8f25c018e821ef41_2'), 2 => $this->get('a27c38881fcb60cd7efcfc1aaed4ab1403ae65ca418be97b8f25c018e821ef41_3')));
     $a->setUsername(NULL);
     $a->setPassword(NULL);
     $a->setAuthMode(NULL);
     $this->services['swiftmailer.mailer.default.transport.real'] = $instance = new \Swift_Transport_EsmtpTransport(new \Swift_Transport_StreamBuffer(new \Swift_StreamFilters_StringReplacementFilterFactory()), array(0 => $a), $this->get('swiftmailer.mailer.default.transport.eventdispatcher'));
     $instance->setHost('127.0.0.1');
     $instance->setPort(25);
     $instance->setEncryption(NULL);
     $instance->setTimeout(30);
     $instance->setSourceIp(NULL);
     return $instance;
 }
All Usage Examples Of Swift_Transport_EsmtpTransport::setTimeout