class Mail::Message
def html_part=(msg)
text_part are both defined in a message, then it will be a multipart/alternative
Helper to add a html part to a multipart/alternative email. If this and
def html_part=(msg) # Assign the html part and set multipart/alternative if there's a text part. if msg msg = Mail::Part.new(:body => msg) unless msg.kind_of?(Mail::Message) @html_part = msg @html_part.content_type = 'text/html' unless @html_part.has_content_type? add_multipart_alternate_header if text_part add_part @html_part # If nil, delete the html part and back out of multipart/alternative. elsif @html_part parts.delete_if { |p| p.object_id == @html_part.object_id } @html_part = nil if text_part self.content_type = nil body.boundary = nil end end end