function EsmtpTransport::doEhloCommand
1 call to EsmtpTransport::doEhloCommand()
- EsmtpTransport::executeCommand in vendor/
symfony/ mailer/ Transport/ Smtp/ EsmtpTransport.php - Runs a command against the stream, expecting the given response codes.
File
-
vendor/
symfony/ mailer/ Transport/ Smtp/ EsmtpTransport.php, line 142
Class
- EsmtpTransport
- Sends Emails over SMTP with ESMTP support.
Namespace
Symfony\Component\Mailer\Transport\SmtpCode
private function doEhloCommand() : string {
try {
$response = $this->executeCommand(\sprintf("EHLO %s\r\n", $this->getLocalDomain()), [
250,
]);
} catch (TransportExceptionInterface $e) {
try {
return parent::executeCommand(\sprintf("HELO %s\r\n", $this->getLocalDomain()), [
250,
]);
} catch (TransportExceptionInterface $ex) {
if (!$ex->getCode()) {
throw $e;
}
throw $ex;
}
}
$this->capabilities = $this->parseCapabilities($response);
/** @var SocketStream $stream */
$stream = $this->getStream();
// WARNING: !$stream->isTLS() is right, 100% sure :)
// if you think that the ! should be removed, read the code again
// if doing so "fixes" your issue then it probably means your SMTP server behaves incorrectly or is wrongly configured
if ($this->autoTls && !$stream->isTLS() && \defined('OPENSSL_VERSION_NUMBER') && \array_key_exists('STARTTLS', $this->capabilities)) {
$this->executeCommand("STARTTLS\r\n", [
220,
]);
if (!$stream->startTLS()) {
throw new TransportException('Unable to connect with STARTTLS.');
}
$response = $this->executeCommand(\sprintf("EHLO %s\r\n", $this->getLocalDomain()), [
250,
]);
$this->capabilities = $this->parseCapabilities($response);
}
if (\array_key_exists('AUTH', $this->capabilities)) {
$this->handleAuth($this->capabilities['AUTH']);
}
return $response;
}