Skip to content

Commit 19d8405

Browse files
author
Oleksii Korshenko
authored
MAGETWO-67680: Replace Zend_Mail (ZF1) with Zend\Mail (ZF2) #8608
2 parents 01ca787 + f570ebf commit 19d8405

File tree

18 files changed

+408
-186
lines changed

18 files changed

+408
-186
lines changed

app/code/Magento/Directory/Model/Observer.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,14 @@ public function scheduledUpdateCurrencyRates($schedule)
126126
}
127127
}
128128

129+
$errorRecipient = $this->_scopeConfig->getValue(
130+
self::XML_PATH_ERROR_RECIPIENT,
131+
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
132+
);
129133
if (sizeof($importWarnings) == 0) {
130134
$this->_currencyFactory->create()->saveRates($rates);
131-
} else {
135+
} elseif ($errorRecipient) {
136+
//if $errorRecipient is not set, there is no sense send email to nobody
132137
$this->inlineTranslation->suspend();
133138

134139
$this->_transportBuilder->setTemplateIdentifier(
@@ -148,12 +153,7 @@ public function scheduledUpdateCurrencyRates($schedule)
148153
self::XML_PATH_ERROR_IDENTITY,
149154
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
150155
)
151-
)->addTo(
152-
$this->_scopeConfig->getValue(
153-
self::XML_PATH_ERROR_RECIPIENT,
154-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
155-
)
156-
);
156+
)->addTo($errorRecipient);
157157
$transport = $this->_transportBuilder->getTransport();
158158
$transport->sendMessage();
159159

app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ protected function prepareMessage()
4848
$template = $this->getTemplate()->setData($this->templateData);
4949
$this->setTemplateFilter($template);
5050

51-
$this->message->setMessageType(
52-
\Magento\Framework\Mail\MessageInterface::TYPE_HTML
53-
)->setBody(
51+
$this->message->setBodyHtml(
5452
$template->getProcessedTemplate($this->templateVars)
5553
)->setSubject(
5654
$template->getSubject()

app/code/Magento/Newsletter/Model/Template.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ class Template extends \Magento\Email\Model\AbstractTemplate
4040
{
4141
/**
4242
* Mail object
43+
*
44+
* @deprecated Unused property
4345
*
44-
* @var \Zend_Mail
4546
*/
4647
protected $_mail;
4748

app/code/Magento/Newsletter/Test/Unit/Model/Queue/TransportBuilderTest.php

+1-12
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,12 @@ public function setUp()
7474

7575
/**
7676
* @param int $templateType
77-
* @param string $messageType
7877
* @param string $bodyText
7978
* @return void
8079
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
8180
*/
8281
public function testGetTransport(
8382
$templateType = TemplateTypesInterface::TYPE_HTML,
84-
$messageType = MessageInterface::TYPE_HTML,
8583
$bodyText = '<h1>Html message</h1>'
8684
) {
8785
$filter = $this->getMock(\Magento\Email\Model\Template\Filter::class, [], [], '', false);
@@ -137,16 +135,7 @@ public function testGetTransport(
137135
$this->messageMock->expects(
138136
$this->once()
139137
)->method(
140-
'setMessageType'
141-
)->with(
142-
$this->equalTo($messageType)
143-
)->will(
144-
$this->returnSelf()
145-
);
146-
$this->messageMock->expects(
147-
$this->once()
148-
)->method(
149-
'setBody'
138+
'setBodyHtml'
150139
)->with(
151140
$this->equalTo($bodyText)
152141
)->will(

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"zendframework/zend-validator": "^2.6.0",
1818
"zendframework/zend-crypt": "^2.6.0",
1919
"zendframework/zend-console": "^2.6.0",
20+
"zendframework/zend-mail": "^2.8.0",
2021
"zendframework/zend-modulemanager": "^2.7",
2122
"zendframework/zend-mvc": "~2.6.3",
2223
"zendframework/zend-text": "^2.6.0",

composer.lock

+137-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)