summaryrefslogtreecommitdiff
path: root/app/mailers/notify.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/mailers/notify.rb')
-rw-r--r--app/mailers/notify.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/mailers/notify.rb b/app/mailers/notify.rb
index 31726563662..28ef6d8d6c6 100644
--- a/app/mailers/notify.rb
+++ b/app/mailers/notify.rb
@@ -68,14 +68,16 @@ class Notify < ApplicationMailer
private
# Return an email address that displays the name of the sender.
- # Only the displayed name changes; the actual email address is always the same.
- def sender(sender_id, send_from_user_email: false, sender_name: nil)
+ # Override sender_email if you want to hard replace the sender address (e.g. custom email for Service Desk)
+ def sender(sender_id, send_from_user_email: false, sender_name: nil, sender_email: nil)
return unless sender = User.find(sender_id)
address = default_sender_address
address.display_name = sender_name.presence || "#{sender.name} (#{sender.to_reference})"
- if send_from_user_email && can_send_from_user_email?(sender)
+ if sender_email
+ address.address = sender_email
+ elsif send_from_user_email && can_send_from_user_email?(sender)
address.address = sender.email
end