% layout 'mainlayout';
% my $mail_fmt = begin
% my ($category, $value) = @_;
% if (ref $value eq 'ARRAY' && $value->@*) {
% if ($content_type eq 'multipart/alternative') {
% my $end;
% for (reverse $body->{parts}->@*) {
% if (!$end) {
% my $x = mime_render(to_mime_type($_->{head}), $_->{body});
%== $x;
% $end = 1 if $x;
% }
% else {
%= to_mime_type $_->{head}
%== mime_render(to_mime_type($_->{head}), $_->{body})
% }
% }
% }
% elsif ($msg->{head}{mime}{content_maintype} eq 'multipart') {
% for ($body->{parts}->@*) {
% if ( !$_->{head}{content_disposition}
% || lc $_->{head}{content_disposition} eq 'none'
% || lc $_->{head}{content_disposition} eq 'inline') {
%== mime_render(to_mime_type($_->{head}), $_->{body}) // "Can not render mime-part of type $_->{head}{content_maintype}/$_->{head}{content_subtype}
."
% }
% elsif (lc $_->{head}{content_disposition} eq 'attachment') {
Attachment <%= $_->{head}{filename} %> of type
%= to_mime_type $_->{head}
% }
% else {
% die "unknown Content-Disposition '$_->{head}{content_disposition}'"
% }
% }
% }
% elsif ($msg->{head}{mime}{content_maintype} eq 'message') {
% die "not implemented" unless $msg->{head}{mime}{content_subtype} eq 'rfc822';
not implemented
% }
% else {
%== mime_render($content_type, $body) // $content_type
% }
% end