<% if @email.respond_to?(:smtp_envelope_from) && Array(@email.from) != Array(@email.smtp_envelope_from) %>
SMTP-From:
<%= @email.smtp_envelope_from %>
<% end %>
<% if @email.respond_to?(:smtp_envelope_to) && @email.to != @email.smtp_envelope_to %>
SMTP-To:
<%= @email.smtp_envelope_to %>
<% end %>
From:
<%= @email.header['from'] %>
<% if @email.reply_to %>
Reply-To:
<%= @email.header['reply-to'] %>
<% end %>
To:
<%= @email.header['to'] %>
<% if @email.cc %>
CC:
<%= @email.header['cc'] %>
<% end %>
Date:
<%= Time.current.rfc2822 %>
Subject:
<%= @email.subject %>
<% unless @email.attachments.nil? || @email.attachments.empty? %>
Attachments:
<% @email.attachments.each do |a| %>
<% filename = a.respond_to?(:original_filename) ? a.original_filename : a.filename %>
<%= link_to filename, "data:application/octet-stream;charset=utf-8;base64,#{Base64.encode64(a.body.to_s)}", download: filename %>
<% end %>
<% end %>
Format:
<% if @email.multipart? %>
value="<%= part_query('text/html') %>">View as HTML email
value="<%= part_query('text/plain') %>">View as plain-text email
<% else %>
<%= @email.mime_type == 'text/html' ? 'HTML email' : 'plain-text email' %>
<% end %>
<% if I18n.available_locales.count > 1 %>
Locale:
<% I18n.available_locales.each do |locale| %>
value="<%= locale_query(locale) %>"><%= locale %>
<% end %>
<% end %>
<% if @part && @part.mime_type %>
<% else %>
You are trying to preview an email that does not have any content.
This is probably because the mail method has not been called in <%= @preview.preview_name %>#<%= @email_action %> .
<% end %>