From a86d1806ae266d09c9d62a48cc2e495e3221a7a4 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 6 Apr 2018 21:47:16 -0400 Subject: [PATCH] Add App->getSenderEmailAddress method --- src/App.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/App.php b/src/App.php index 55623e1e8..1acd35ac3 100644 --- a/src/App.php +++ b/src/App.php @@ -1047,4 +1047,24 @@ class App unset($this->config[$uid][$cat][$k]); } } + + /** + * Generates the site's default sender email address + * + * @return string + */ + public function getSenderEmailAddress() + { + $sender_email = Config::get('config', 'sender_email'); + if (empty($sender_email)) { + $hostname = $this->get_hostname(); + if (strpos($hostname, ':')) { + $hostname = substr($hostname, 0, strpos($hostname, ':')); + } + + $sender_email = L10n::t('noreply') . '@' . $hostname; + } + + return $sender_email; + } }