-
Couldn't load subscription status.
- Fork 254
Description
Evening folks, hope you are well!
Would you be interested in adding instrumentation support to premailer-rails?
Recently I've been working on a small feature that relies on mail interception. I'm using premailer-rails to generate text parts for emails. I've had a hard time figuring out why emails intercepted by my custom interceptor had their text_part set to nil. I was using initializer file to register it and as it turned out, my interceptor was added before Premailer::Rails::Hook.
I thought it'd be cool if you could hook into premailer-rails initializaition process to ensure that your custom interceptors are registered after those defined by premailer-rails. Here's what I've in mind:
class Premailer
module Rails
class Railtie < ::Rails::Railtie
ActiveSupport.on_load(:action_mailer) do
ActiveSupport::Notifications.instrument("register_interceptors.premailer_rails") do
::Premailer::Rails.register_interceptors
end
end
end
end
end
# initializer
ActiveSupport::Notifications.subscribe "register_interceptors.premailer_rails" do
ActionMailer::Base.register_interceptor(MyCustomInterceptor)
endIs that something you'd be interested in?
Looking forward to you response,
Cheers!