<% if @email.cc.any? %> <% end %> <% if @email.bcc.any? %> <% end %>
Mailbox: <%= link_to @email.mailbox.name, mailbox_path(@email.mailbox) %>
From:
To: <% @email.to.each do |email_address| %> <% end %>
CC: <% @email.cc.each do |email_address| %> <% end %>
BCC: <% @email.bcc.each do |email_address| %> <% end %>
Subject: <%= @email.subject %>
Template: <%= link_to @email.template_name, @email.link_to_template, target: '_blank' %>
Received: <%= l(@email.created_at, format: :long) %>

<%= link_to "HTML", email_path(@email, selected: 'html'), class: 'button', 'data-turbolinks-action': "replace" %> <%= link_to "Plain Text", email_path(@email, selected: 'plain_text'), class: 'button', 'data-turbolinks-action': "replace" %> <%= link_to "Source", email_path(@email, selected: 'source'), class: 'button', 'data-turbolinks-action': "replace" %>

<% if @selected == 'plain_text' %>

Plain Text

<%= simple_format(@email.rendered_plain_text) %>
<% elsif @selected == 'source' %>

Request

<%= JSON.pretty_generate(@email.request_payload) %>

Personalization

<%= JSON.pretty_generate(@email.personalization) %>

Template

<%= JSON.pretty_generate(@email.template_payload) %>
<% else %>

HTML

<% end %>