summaryrefslogtreecommitdiff
path: root/lib/email_template_interceptor.rb
blob: 63f9f8d7a5af7f071ab66a34f11c4d67c09550c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# 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.parts.delete_if do |part|
        part.content_type.start_with?('text/html')
      end
    end
  end
end