diff --git a/docs/en/02_Developer_Guides/10_Email/index.md b/docs/en/02_Developer_Guides/10_Email/index.md index 15ed00fbad5..7954e338465 100644 --- a/docs/en/02_Developer_Guides/10_Email/index.md +++ b/docs/en/02_Developer_Guides/10_Email/index.md @@ -215,6 +215,8 @@ email marked as spam. If you want to send from another address think about using You will also have to remove the `SS_SEND_ALL_EMAILS_FROM` environment variable if it is present. +If you need greater control over this email address, for instance if are running the subsites modules, you can implement the `SilverStripe\Control\Email\Email::updateDefaultFrom()` extension hook. + ## Redirecting Emails There are several other [configuration settings](/developer_guides/configuration) to manipulate the email server. diff --git a/src/Control/Email/Email.php b/src/Control/Email/Email.php index 7396a129c8d..793e44d2b95 100644 --- a/src/Control/Email/Email.php +++ b/src/Control/Email/Email.php @@ -297,6 +297,7 @@ private function getDefaultFrom(): string } $defaultFrom = sprintf('no-reply@%s', $host); } + $this->extend('updateDefaultFrom', $defaultFrom); return $defaultFrom; }