% layout 'mainlayout'; % my $mail_fmt = begin % my ($category, $value) = @_; % if (ref $value eq 'ARRAY' && $value->@*) {
<%= uc l $category %>
% for ($value->@*) {
%= $_->{name} ? qq("$_->{name}" <$_->{address}>) : "$_->{address}"
% } % } % end

Read Mail

<%= uc l 'subject' %>
<%= $msg->{head}{subject} %>
%= $mail_fmt->(from => $msg->{head}{from}) %= $mail_fmt->(to => $msg->{head}{to}) %= $mail_fmt->(cc => $msg->{head}{cc}) %= $mail_fmt->(bcc => $msg->{head}{bcc})
<%= uc l 'date' %>
<%= $msg->{head}{date} %>
% my $content_type = $msg->{head}{mime}{content_maintype} . '/' . $msg->{head}{mime}{content_subtype};
<%= uc l 'content-type' %>
<%= $content_type %>
% my $body = $msg->{body}; % if ($content_type eq 'multipart/alternative') { % for (reverse @{$body->{parts}}) {
% my $x = mime_render($_->{head}{content_maintype}.'/'.$_->{head}{content_subtype}, $_->{body}); %== $x;
% last if $x; % } % } % elsif ($msg->{head}{mime}{content_maintype} eq 'multipart') { % for (@{$body->{parts}}) {
%== mime_render($_->{head}{content_maintype}.'/'.$_->{head}{content_subtype}, $_->{body});
% } % } % elsif ($msg->{head}{mime}{content_maintype} eq 'message') { % die "not implemented" % } % else {
%== mime_render($content_type, $body);
% }