Skip to content

Commit 4bbd01b

Browse files
author
Hayder Sharhan
committed
MAGETWO-52707: [github] SMTP settings are not used
- Added a plugin to configure php init according to settings if on windows host.
1 parent c15593f commit 4bbd01b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app/code/Magento/Email/Model/Plugin/WindowsSMTPConfig.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Plugin for \Magento\Framework\Mail\TransportInterface
1010
*/
11-
class WindowsSMTPConfig
11+
class WindowsSmtpConfig
1212
{
1313
/**
1414
* host config path
@@ -43,14 +43,15 @@ public function __construct(
4343
}
4444

4545
/**
46+
* To configure smtp settings for session right before sending message on windows server
47+
*
4648
* @param \Magento\Framework\Mail\TransportInterface $subject
4749
* return void
48-
*
4950
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5051
*/
5152
public function beforeSendMessage(\Magento\Framework\Mail\TransportInterface $subject)
5253
{
53-
if (!$this->osInfo->isWindows()) {
54+
if ($this->osInfo->isWindows()) {
5455
ini_set('SMTP', $this->config->getValue(self::XML_SMTP_HOST));
5556
ini_set('smtp_port', $this->config->getValue(self::XML_SMTP_PORT));
5657
}

app/code/Magento/Email/etc/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,6 @@
5858
</arguments>
5959
</type>
6060
<type name="Magento\Framework\Mail\TransportInterface">
61-
<plugin name="WindowsSMTPConfig" type="Magento\Email\Model\Plugin\WindowsSMTPConfig" />
61+
<plugin name="WindowsSmtpConfig" type="Magento\Email\Model\Plugin\WindowsSmtpConfig" />
6262
</type>
6363
</config>

0 commit comments

Comments
 (0)