A webmail client. Forked from https://git.sr.ht/~migadu/alps
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

209 lines
7.8 KiB

  1. {{template "head.html" .}}
  2. {{template "nav.html" .}}
  3. {{template "util.html" .}}
  4. <div class="page-wrap">
  5. {{ $current := .Mailbox }}
  6. {{ template "aside" . }}
  7. <div class="container">
  8. <main class="message">
  9. <section class="actions">
  10. <div class="actions-wrap">
  11. <div class="actions-message">
  12. {{$back := printf "%v?page=%v" .Mailbox.URL .MailboxPage}}
  13. <a href="{{$back}}" class="button-link">« Back</a>
  14. {{ if and (ne .Mailbox.Name "Archive") (ne .Mailbox.Name "Drafts") (ne .Mailbox.Name "Sent") }}
  15. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  16. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  17. <input type="hidden" name="to" value="Archive">
  18. <input type="hidden" name="next" value="{{$back}}">
  19. <button>Archive</button>
  20. </form>
  21. {{ end }}
  22. {{ if and (ne .Mailbox.Name "INBOX") (ne .Mailbox.Name "Sent") (ne .Mailbox.Name "Drafts") }}
  23. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  24. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  25. <input type="hidden" name="to" value="INBOX">
  26. <button>
  27. {{ if (eq .Mailbox.Name "Junk") }}
  28. Not Spam
  29. {{ else }}
  30. Move to Inbox
  31. {{ end }}
  32. </button>
  33. </form>
  34. {{ end }}
  35. {{ if or (eq .Mailbox.Name "INBOX") (eq .Mailbox.Name "Trash") }}
  36. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  37. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  38. <input type="hidden" name="next" value="{{$back}}">
  39. <input type="hidden" name="to" value="Junk">
  40. <button>Report Spam</button>
  41. </form>
  42. {{ end }}
  43. {{ if or (eq .Mailbox.Name "Trash") (eq .Mailbox.Name "Junk") }}
  44. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/delete">
  45. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  46. <input type="hidden" name="next" value="{{$back}}">
  47. <button>Delete Permanently</button>
  48. </form>
  49. {{ else }}
  50. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  51. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  52. <input type="hidden" name="next" value="{{$back}}">
  53. <input type="hidden" name="to" value="Trash">
  54. <button>Delete</button>
  55. </form>
  56. {{ end }}
  57. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/flag">
  58. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  59. <input type="hidden" name="action" value="remove">
  60. <input type="hidden" name="flags" value="\Seen">
  61. <input type="hidden" name="next" value="{{$back}}">
  62. <button>Mark&nbsp;Unread</button>
  63. </form>
  64. <form class="action-group" method="post" action="/message/{{.Mailbox.Name | pathescape}}/move">
  65. <input type="hidden" name="uids" value="{{.Message.Uid}}">
  66. <select class="action-group" name="to">
  67. {{range .Mailboxes}}
  68. <option value="{{.Name}}" {{if eq .Name $.Mailbox.Name}}selected>Move to...{{else}}>{{.Name}}{{ end }}</option>
  69. {{end}}
  70. </select>
  71. <button class="action-group" type="submit">Move</button>
  72. </form>
  73. <span class="followups">
  74. {{if .Message.HasFlag "\\Draft"}}
  75. <a class="action-group button-link" href="{{.Message.URL}}/edit{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Edit draft</a>
  76. {{else}}
  77. <a class="action-group button-link" href="{{.Message.URL}}/reply{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Reply</a>
  78. <a class="action-group button-link" href="{{.Message.URL}}/forward{{if .Message.TextPart}}?part={{.Message.TextPart.PathString}}{{end}}">Forward</a>
  79. {{end}}
  80. </span>
  81. </div>
  82. </div>
  83. </section>
  84. <div class="message-header">
  85. <table>
  86. <tr>
  87. <th colspan="2">
  88. <h1>
  89. {{if .Message.Envelope.Subject}}
  90. {{.Message.Envelope.Subject}}
  91. {{else}}
  92. (No subject)
  93. {{end}}
  94. </h1>
  95. </th>
  96. </tr>
  97. <tr>
  98. <th>From:</th>
  99. <td>{{template "addr-list" .Message.Envelope.From}}</td>
  100. </tr>
  101. <tr>
  102. <th>Date:</th>
  103. <td>{{.Message.Envelope.Date | formatdate}}</td>
  104. </tr>
  105. <tr>
  106. <th>To:</th><td>{{template "addr-list" .Message.Envelope.To}}</td>
  107. </tr>
  108. {{if .Message.Envelope.Cc}}
  109. <tr>
  110. <th>Cc:</th><td>{{template "addr-list" .Message.Envelope.Cc}}</td>
  111. </tr>
  112. {{end}}
  113. {{if .Message.Envelope.Bcc}}
  114. <tr>
  115. <th>Bcc:</th>
  116. <td>{{template "addr-list" .Message.Envelope.Bcc}}</td>
  117. </tr>
  118. {{ end }}
  119. {{if and .Extra.HasRemoteResources (not .Extra.RemoteResourcesAllowed)}}
  120. <tr class="remote-content">
  121. <td colspan="2">
  122. This message contains remote content, such as external images.
  123. <a href="?part={{.Part.PathString}}&allow-remote-resources=1">
  124. Load remote content »
  125. </a>
  126. </td>
  127. </tr>
  128. {{end}}
  129. </table>
  130. {{ $attachments := .Message.Attachments }}
  131. {{ if $attachments }}
  132. <section class="parts">
  133. <h3>Attachments</h3>
  134. <ul>
  135. {{ range .Message.Attachments }}
  136. <li>
  137. <a
  138. class="nav-link"
  139. {{if .IsText}}
  140. href="?part={{.PathString}}"
  141. {{else}}
  142. href="{{$.Message.URL}}/raw?part={{.PathString}}"
  143. {{end}}
  144. >
  145. {{- if .Filename -}}
  146. {{.Filename}}
  147. {{- else -}}
  148. (no filename)
  149. {{- end -}}
  150. </a> ({{.MIMEType}}, {{.SizeString}})
  151. </li>
  152. {{ end }}
  153. </ul>
  154. </section>
  155. {{ end }}
  156. </div>
  157. {{define "addr-list"}}
  158. {{range $i, $addr := .}}
  159. {{if $i}},{{end}}
  160. <strong>{{.PersonalName}}</strong>
  161. &lt;<a href="/compose?to={{.Address}}">{{.Address}}</a>&gt;
  162. {{end}}
  163. {{end}}
  164. {{ $html := .Message.HTMLPart }}
  165. {{ $text := .Message.TextPart }}
  166. <div class="tabs">
  167. {{/* https://github.com/golang/go/issues/31103 */}}
  168. <a
  169. href="?part={{$text.PathString}}"
  170. {{ if eq $text.PathString .Part.PathString }}
  171. class="active"
  172. {{ end }}
  173. >Plain text</a>
  174. {{ if and $html $text }}
  175. {{ if ne $html.PathString $text.PathString }}
  176. <a
  177. href="?part={{$html.PathString}}"
  178. {{ if eq $html.PathString .Part.PathString }}
  179. class="active"
  180. {{ end }}
  181. >HTML</a>
  182. {{ end }}
  183. {{ end }}
  184. <a href="{{.Message.URL}}/raw?plain=1">Raw email</a>
  185. </div>
  186. {{if .View}}
  187. {{.View}}
  188. {{else}}
  189. <p>Can't preview this message part.</p>
  190. <a href="{{.Message.URL}}/raw?part={{.Part.PathString}}">Download</a>
  191. {{end}}
  192. </main>
  193. </div>
  194. </div>
  195. {{template "foot.html"}}