Skip to content

Commit a8bcb8b

Browse files
author
Graham Wharton
committed
Deprecated Magento\Framework\Mail\Message::setFrom function, introduced new function setFromAddress
1 parent 59a4e57 commit a8bcb8b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/internal/Magento/Framework/Mail/Message.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,23 @@ public function getBody()
8989

9090
/**
9191
* @inheritdoc
92+
*
93+
* @deprecated This function is missing the from name. The
94+
* setFromAddress() function sets both from address and from name.
95+
* @see setFromAddress()
9296
*/
9397
public function setFrom($fromAddress)
9498
{
95-
$this->zendMessage->setFrom($fromAddress);
99+
$this->setFromAddress($fromAddress, null);
100+
return $this;
101+
}
102+
103+
/**
104+
* @inheritdoc
105+
*/
106+
public function setFromAddress($fromAddress, $fromName = null)
107+
{
108+
$this->zendMessage->setFrom($fromAddress, $fromName);
96109
return $this;
97110
}
98111

lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function setFrom($from)
196196
public function setFromByStore($from, $store = null)
197197
{
198198
$result = $this->_senderResolver->resolve($from, $store);
199-
$this->message->setFrom($result['email'], $result['name']);
199+
$this->message->setFromAddress($result['email'], $result['name']);
200200
return $this;
201201
}
202202

0 commit comments

Comments
 (0)