You are here

public function ConnectionTester::__construct in SMTP Authentication Support 8

The SMTP ConnectionTester constructor.

Parameters

\Drupal\Core\Config\ConfigFactory $config_factory:

\Psr\Log\LoggerInterface $logger: The logger channel.

\Drupal\Core\Mail\MailManagerInterface $mail_manager: The Mail manager.

File

src/ConnectionTester/ConnectionTester.php, line 82

Class

ConnectionTester
Allows testing the SMTP connection.

Namespace

Drupal\smtp\ConnectionTester

Code

public function __construct(ConfigFactory $config_factory, LoggerInterface $logger, MailManagerInterface $mail_manager) {
  $this->configFactory = $config_factory;
  $this->smtpConfig = $config_factory
    ->get('smtp.settings');
  $this->mailManager = $mail_manager;
  $this->logger = $logger;
  if (!class_exists(PHPMailer::class)) {
    $this->logger
      ->error('Unable to initialize PHPMailer, Class does not exist.');
    return;
  }
  $this->phpMailer = new PHPMailer(TRUE);
}