function SmtpTransport::stop
Manually disconnect from the SMTP server.
In most cases this is not necessary since the disconnect happens automatically on termination. In cases of long-running scripts, this might however make sense to avoid keeping an open connection to the SMTP server in between sending emails.
3 calls to SmtpTransport::stop()
- SmtpTransport::checkRestartThreshold in vendor/
symfony/ mailer/ Transport/ Smtp/ SmtpTransport.php - SmtpTransport::ping in vendor/
symfony/ mailer/ Transport/ Smtp/ SmtpTransport.php - SmtpTransport::__destruct in vendor/
symfony/ mailer/ Transport/ Smtp/ SmtpTransport.php
File
-
vendor/
symfony/ mailer/ Transport/ Smtp/ SmtpTransport.php, line 295
Class
- SmtpTransport
- Sends emails over SMTP.
Namespace
Symfony\Component\Mailer\Transport\SmtpCode
public function stop() : void {
if (!$this->started) {
return;
}
$this->getLogger()
->debug(\sprintf('Email transport "%s" stopping', __CLASS__));
try {
$this->executeCommand("QUIT\r\n", [
221,
]);
} catch (TransportExceptionInterface) {
} finally {
$this->stream
->terminate();
$this->started = false;
$this->getLogger()
->debug(\sprintf('Email transport "%s" stopped', __CLASS__));
}
}