aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/notification.php24
1 files changed, 15 insertions, 9 deletions
diff --git a/engine/lib/notification.php b/engine/lib/notification.php
index aa4bf35cf..1494c06e7 100644
--- a/engine/lib/notification.php
+++ b/engine/lib/notification.php
@@ -206,9 +206,10 @@
* @param string $subject The subject of the message.
* @param string $message The message body
* @param array $params Optional parameters (none taken in this instance)
+ * @param bool $hide_sender If true (default) hide the sender's email address (use noreply@site...)
* @return bool
*/
- function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL)
+ function email_notify_handler(ElggEntity $from, ElggUser $to, $subject, $message, array $params = NULL, $hide_sender = true)
{
global $CONFIG;
@@ -222,16 +223,21 @@
throw new NotificationException(sprintf(elgg_echo('NotificationException:NoEmailAddress'), $to->guid));
$to = $to->email;
- if ($from->email)
- $from = $from->email; // Handle users
- else if ($from->url)
+ if (!$hide_sender)
{
- $breakdown = parse_url($from->url);
- $from = 'noreply@' . $breakdown['host']; // Handle anything with a url
- }
- else {
- $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback
+ if ($from->email)
+ $from = $from->email; // Handle users
+ else if ($from->url)
+ {
+ $breakdown = parse_url($from->url);
+ $from = 'noreply@' . $breakdown['host']; // Handle anything with a url
+ }
+ else {
+ $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback
+ }
}
+ else
+ $from = 'noreply@' . get_site_domain($CONFIG->site_guid); // Handle a fallback
$headers = "From: $from\r\n";