1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 08:44:46 +02:00

Update wireMail fallback from email settings with 2nd check in case 3rd party module made default blank, plus update auto-detect from email logic in ProcessForgotPassword so it can't override configured wireMail settings with config.adminEmail

This commit is contained in:
Ryan Cramer
2021-02-19 14:56:06 -05:00
parent bfdb2a09d2
commit 1244b4bd48
2 changed files with 8 additions and 1 deletions

View File

@@ -629,10 +629,13 @@ class WireMail extends WireData implements WireMailInterface {
*/
protected function renderMailHeader() {
$settings = $this->wire()->config->wireMail;
$from = $this->from;
if(!strlen($from) && !empty($settings['from'])) $from = $settings['from'];
if(!strlen($from)) $from = $this->wire('config')->adminEmail;
if(!strlen($from)) $from = 'processwire@' . $this->wire('config')->httpHost;
$header = "From: " . ($this->fromName ? $this->bundleEmailAndName($from, $this->fromName) : $from);
foreach($this->header as $key => $value) {

View File

@@ -939,6 +939,10 @@ class ProcessForgotPassword extends Process implements ConfigurableModule {
*/
protected function getEmailFrom() {
$emailFrom = $this->emailFrom;
if(empty($emailFrom)) {
$settings = $this->wire()->config->wireMail;
if(!empty($settings['from'])) $emailFrom = $settings['from'];
}
if(empty($emailFrom)) $emailFrom = $this->wire('config')->adminEmail;
if(empty($emailFrom)) $emailFrom = 'noreply@' . $this->wire('config')->httpHost;
return $emailFrom;