module ActionMailer::Text

Constants

VERSION

Public Class Methods

included(klass) click to toggle source
# File lib/actionmailer-text/text.rb, line 3
def self.included(klass)
  klass.class_eval do
    include ActionMailer::Text::HtmlToPlainText
  end
end

Public Instance Methods

collect_responses(headers) click to toggle source
Calls superclass method
# File lib/actionmailer-text/text.rb, line 9
def collect_responses(headers)
  responses = super headers
  html_part = responses.detect { |response| response[:content_type] == 'text/html' }
  text_part = responses.detect { |response| response[:content_type] == 'text/plain' }
  if html_part && !text_part
    responses.insert 0, content_type: 'text/plain', body: convert_to_text(html_part[:body], nil)
    headers[:parts_order] = ['text/plain'] + headers[:parts_order] unless headers[:parts_order].include?('text/plain')
  end
  responses
end