Skip to content

Commit 648c8b5

Browse files
committed
Add defaults for from
1 parent dd216ce commit 648c8b5

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

src/Mailer/Mailer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Mailer extends CakeMailer {
2020
* Message class name.
2121
*
2222
* @var string
23+
* @psalm-var class-string<\Cake\Mailer\Message>
2324
*/
2425
protected $messageClass = Message::class;
2526

src/Mailer/Message.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,16 @@ public function __construct(?array $config = null) {
2929
if ($xMailer) {
3030
$this->addHeaders(['X-Mailer' => $xMailer]);
3131
}
32+
33+
$this->setDefaults();
3234
}
3335

3436
/**
3537
* Overwrite to allow custom enhancements
3638
*
37-
* @param array|string $config
38-
* @return $this
39+
* @return void
3940
*/
40-
public function _setProfile($config) {
41-
if (!is_array($config)) {
42-
$config = (string)$config;
43-
}
44-
//$this->_applyConfig($config);
45-
41+
protected function setDefaults(): void {
4642
$fromEmail = Configure::read('Config.systemEmail');
4743
if ($fromEmail) {
4844
$fromName = Configure::read('Config.systemName');
@@ -51,10 +47,8 @@ public function _setProfile($config) {
5147
$fromName = Configure::read('Config.adminName');
5248
}
5349
if ($fromEmail) {
54-
//$this->setFrom($fromEmail, $fromName);
50+
$this->setFrom($fromEmail, $fromName);
5551
}
56-
57-
return $this;
5852
}
5953

6054
/**

0 commit comments

Comments
 (0)