<% if email.is_a?(Mail::Message) this_part = email elsif email.length > 0 begin this_part = Mail.new(email) rescue => e %>
     An error occured parsing this part of the email: <%= e.message %>
     <%= e.backtrace.join("\n") %>
     
<% end end%> <% unless this_part.nil? %>

Headers

      <%= this_part.header.inspect %>
    
<% if this_part.header['content-type'].to_s =~ /text\/html/i %>

Body Part

<%= this_part.body %> <% elsif this_part.header['content-type'].to_s =~ /text\/plain|message\/delivery-status|text\/rfc822-headers/i %>

Body Part

<%= this_part.body %>
<% end %> <% this_part.parts.each do |part| %> <%= render :partial => 'mail_manager/bounces/email_parts', :locals => {:email => part} %> <% end end %>