diff --git a/CHANGELOG.md b/CHANGELOG.md index 36fdd16..ce91347 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 2.2.4 (under development) +## 2.2.4 (Mar 11, 2024) - Added mailer transport DSN fallback (Issues #24) - Added support for `color` type input fields (Issue #22) diff --git a/src/base/traits/ApplicationTrait.php b/src/base/traits/ApplicationTrait.php index 0b42521..325f3b6 100644 --- a/src/base/traits/ApplicationTrait.php +++ b/src/base/traits/ApplicationTrait.php @@ -187,8 +187,11 @@ protected function preInitInternal(&$config): void $config['components']['db'] = array_merge(require ($db), $config['components']['db']); } - // Mailer transport DSN might need to be set via params (eg. yii2-config module) - $config['components']['mailer']['transport']['dsn'] ??= $config['params']['mailerDsn'] ?? 'sendmail://default'; + // Mailer transport DSN might need to be set via params (e.g., `yii2-config` module), but only set it if + // `useFileTransport` is not active. + if (!($config['components']['mailer']['useFileTransport'] ?? false)) { + $config['components']['mailer']['transport']['dsn'] = $config['params']['mailerDsn'] ?? 'sendmail://default'; + } // Make sure the cache prefix via params is applied before application bootstrap, as a DB session might get // started which could trigger the database schema cache.