gitlab-org--gitlab-foss/lib/email_template_interceptor.rb
Ruben Davila b62e2bedbf Add new configuration setting to enable/disable HTML emails.
This new global setting will allow admins to specify if HTML emails should be sent or not,
this is basically useful when system administrators want to save some disk space by avoiding
emails in HTML format and using only the Plain Text version.
2016-11-28 17:00:03 -05:00

13 lines
444 B
Ruby

# Read about interceptors in http://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
class EmailTemplateInterceptor
include Gitlab::CurrentSettings
def self.delivering_email(message)
# Remove HTML part if HTML emails are disabled.
unless current_application_settings.html_emails_enabled
message.part.delete_if do |part|
part.content_type.try(:start_with?, 'text/html')
end
end
end
end