gitlab-org--gitlab-foss/lib/email_template_interceptor.rb
Ruben Davila c6ebe440da Use #parts instead of #part to read all the parts of the Message.
Looks like I was accidentally using #part which was adding an extra
empty Mime section
2017-01-09 13:01:07 -05:00

13 lines
439 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.parts.delete_if do |part|
part.content_type.start_with?('text/html')
end
end
end
end