Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
WindowsSmtpConfig.php
Go to the documentation of this file.
1 <?php
7 
12 {
16  const XML_SMTP_HOST = 'system/smtp/host';
17 
21  const XML_SMTP_PORT = 'system/smtp/port';
22 
26  private $config;
27 
31  private $osInfo;
32 
37  public function __construct(
38  \Magento\Framework\App\Config\ReinitableConfigInterface $config,
39  \Magento\Framework\OsInfo $osInfo
40  ) {
41  $this->config = $config;
42  $this->osInfo = $osInfo;
43  }
44 
52  public function beforeSendMessage(\Magento\Framework\Mail\TransportInterface $subject)
53  {
54  if ($this->osInfo->isWindows()) {
55  ini_set('SMTP', $this->config->getValue(self::XML_SMTP_HOST));
56  ini_set('smtp_port', $this->config->getValue(self::XML_SMTP_PORT));
57  }
58  }
59 }
__construct(\Magento\Framework\App\Config\ReinitableConfigInterface $config, \Magento\Framework\OsInfo $osInfo)
ini_set($varName, $newValue)
$config
Definition: fraud_order.php:17
beforeSendMessage(\Magento\Framework\Mail\TransportInterface $subject)