This repository was archived by the owner on Apr 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +20
-7
lines changed
lib/internal/Magento/Framework/Mail Expand file tree Collapse file tree 5 files changed +20
-7
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ public function setFrom($from)
200200 public function setFromByStore ($ from , $ store = null )
201201 {
202202 $ result = $ this ->_senderResolver ->resolve ($ from , $ store );
203- $ this ->message ->setFrom ($ result ['email ' ], $ result ['name ' ]);
203+ $ this ->message ->setFromAddress ($ result ['email ' ], $ result ['name ' ]);
204204 return $ this ;
205205 }
206206
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public function __construct(
5454 public function setFromByStore ($ from , $ store )
5555 {
5656 $ result = $ this ->senderResolver ->resolve ($ from , $ store );
57- $ this ->message ->setFrom ($ result ['email ' ], $ result ['name ' ]);
57+ $ this ->message ->setFromAddress ($ result ['email ' ], $ result ['name ' ]);
5858
5959 return $ this ;
6060 }
Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ public function testSetFromByStore()
5555 ->with ($ sender , $ store )
5656 ->willReturn ($ sender );
5757 $ this ->messageMock ->expects ($ this ->once ())
58- ->method ('setFrom ' )
59- ->with (' from@example.com ' , 'name ' )
58+ ->method ('setFromAddress ' )
59+ ->with ($ sender [ ' email ' ], $ sender [ 'name ' ] )
6060 ->willReturnSelf ();
6161
6262 $ this ->model ->setFromByStore ($ sender , $ store );
Original file line number Diff line number Diff line change @@ -176,8 +176,8 @@ public function testSetFromByStore()
176176 ->with ($ sender , $ store )
177177 ->willReturn ($ sender );
178178 $ this ->messageMock ->expects ($ this ->once ())
179- ->method ('setFrom ' )
180- ->with (' from@example.com ' , 'name ' )
179+ ->method ('setFromAddress ' )
180+ ->with ($ sender [ ' email ' ], $ sender [ 'name ' ] )
181181 ->willReturnSelf ();
182182
183183 $ this ->builder ->setFromByStore ($ sender , $ store );
You can’t perform that action at this time.
0 commit comments