Class: ActiveMail::Inliner::Interceptor

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/activemail/inliner/interceptor.rb

Class Method Summary collapse

Class Method Details

.delivering_email(message) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/activemail/inliner/interceptor.rb', line 13

def delivering_email(message)
  config = ActiveMail.configuration
  # Runtime check: an engine initializer runs before the host's, so a
  # boot-time flag read would always see the default.
  return unless config.register_inline_interceptor

  inliner = config.resolved_inliner
  return if inliner.noop?

  html_parts(message).each do |part|
    part.body = inliner.inline(part.body.to_s)
  rescue StandardError => e
    # Surface which inliner failed; do not swallow (a silently non-inlined
    # mail is worse). Ruby sets e as #cause, preserving the original backtrace.
    raise ActiveMail::Inliner::Error, "[#{inliner.class}] CSS inlining failed: #{e.message}"
  end
end