From fcf5549584b69e62b6c2f0eb919f6799c7904211 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Fri, 10 Mar 2023 13:54:57 +0100 Subject: Proper recursive rendering of mails to html 1. Added raw mode to model 2. Added raw route 3. Moved readmail view parts to RenderMail plugin 4. Renamed displayheaders partial templates --- templates/webmail/readmail.html.ep | 89 +------------------------------------- 1 file changed, 1 insertion(+), 88 deletions(-) (limited to 'templates/webmail/readmail.html.ep') diff --git a/templates/webmail/readmail.html.ep b/templates/webmail/readmail.html.ep index e1f299d..5bdc27e 100644 --- a/templates/webmail/readmail.html.ep +++ b/templates/webmail/readmail.html.ep @@ -1,98 +1,11 @@ % layout 'mainlayout'; -% my $mail_fmt = begin -% my ($category, $value) = @_; -% if (ref $value eq 'ARRAY' && $value->@*) { -
<%= uc l $category %>
-% for ($value->@*) { -
-%= $_->{display_name} ? qq("$_->{display_name}" <$_->{address}>) : "$_->{address}" -
-% } -% } -% end - - -% my $format_mail = begin -% my ($msg) = @_; -% my $body = $msg->{body}; -% my $content_type = to_mime_type $msg->{head}{mime}; - -
- -
-
<%= 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} %>
-
<%= uc l 'content-type' %>
-
<%= $content_type %>
-
- -% 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 - -

Read Mail

-%= $format_mail->($msg) +%= $c->render_mail->format_mail($msg)