Merge pull request #10251 from creative-commoners/pulls/4/exthook

API Add extension hook for email default from
This commit is contained in:
Michal Kleiner 2022-03-08 16:04:21 +13:00 committed by GitHub
commit 7d8ea82be4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -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. 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 ## Redirecting Emails
There are several other [configuration settings](/developer_guides/configuration) to manipulate the email server. There are several other [configuration settings](/developer_guides/configuration) to manipulate the email server.

View File

@ -297,6 +297,7 @@ class Email extends ViewableData
} }
$defaultFrom = sprintf('no-reply@%s', $host); $defaultFrom = sprintf('no-reply@%s', $host);
} }
$this->extend('updateDefaultFrom', $defaultFrom);
return $defaultFrom; return $defaultFrom;
} }