Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SmtpTransport.php

function SmtpTransport::__toString

File

vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php, line 172

Class

SmtpTransport
Sends emails over SMTP.

Namespace

Symfony\Component\Mailer\Transport\Smtp

Code

public function __toString() : string {
    if ($this->stream instanceof SocketStream) {
        $name = \sprintf('smtp%s://%s', ($tls = $this->stream
            ->isTLS()) ? 's' : '', $this->stream
            ->getHost());
        $port = $this->stream
            ->getPort();
        if (!(25 === $port || $tls && 465 === $port)) {
            $name .= ':' . $port;
        }
        return $name;
    }
    return 'smtp://sendmail';
}
RSS feed
Powered by Drupal