17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/mailbin/messages_controller.rb', line 17
def show
@email = Mailbin.find(params[:id])
@attachments = attachments_for(@email).reject { |filename, attachment| attachment.inline? }
@inline_attachments = attachments_for(@email).select { |filename, attachment| attachment.inline? }
if params[:part]
part_type = Mime::Type.lookup(params[:part])
if part = find_part(part_type)
response.content_type = part_type
render plain: part.respond_to?(:decoded) ? part.decoded : part
else
raise AbstractController::ActionNotFound, "Email part '#{part_type}' not found in #{@preview.name}##{@email_action}"
end
else
@part = find_preferred_part(request.format, Mime[:html], Mime[:text])
end
end
|