class ActionMailer::InlinePreviewInterceptor
Implements a mailer preview interceptor that converts image tag src attributes that use inline cid: style urls to data: style urls so that they are visible when previewing an HTML email in a web browser.
This interceptor is enabled by default. To disable it, delete it from the
ActionMailer::Base.preview_interceptors
array:
ActionMailer::Base.preview_interceptors.delete(ActionMailer::InlinePreviewInterceptor)
Constants
- PATTERN
Private Instance Methods
data_url(part)
click to toggle source
# File lib/action_mailer/inline_preview_interceptor.rb, line 49 def data_url(part) "data:#{part.mime_type};base64,#{strict_encode64(part.body.raw_source)}" end
find_part(cid)
click to toggle source
# File lib/action_mailer/inline_preview_interceptor.rb, line 53 def find_part(cid) message.all_parts.find { |p| p.attachment? && p.cid == cid } end
html_part()
click to toggle source
# File lib/action_mailer/inline_preview_interceptor.rb, line 45 def html_part @html_part ||= message.html_part end
message()
click to toggle source
# File lib/action_mailer/inline_preview_interceptor.rb, line 41 def message @message end