Files
mailgoserver/internal/webui/templates/view_message_content.html
T

73 lines
3.9 KiB
HTML

{{define "view_message_content.html"}}
<div class="mb-3">
<strong>From:</strong> {{.log.mail_from}}<br>
<strong>To:</strong> {{.log.to_address}}<br>
<strong>CC:</strong> {{if .log.cc_addresses}}{{.log.cc_addresses}}{{else}}None{{end}}<br>
<strong>BCC:</strong> {{if .log.bcc_addresses}}{{.log.bcc_addresses}}{{else}}None{{end}}<br>
<strong>Subject:</strong> {{if .log.subject}}{{.log.subject}}{{else}}N/A{{end}}<br>
<strong>Date:</strong> {{strftime "%Y-%m-%d %H:%M:%S" .log.created_at}}<br>
</div>
{{if .log.attachments}}
<div class="card mb-3">
<div class="card-header"><strong>Attachments:</strong></div>
<div class="card-body">
{{range .log.attachments}}
<div class="mb-3">
<div class="d-flex justify-content-between align-items-center">
<div><i class="bi bi-paperclip me-1"></i>{{.Filename}} <small class="text-muted">({{.ContentType}}, {{filesize .Size}})</small></div>
<a href="{{.DataURI}}" target="_blank" rel="noopener" download="{{.Filename}}" class="btn btn-sm btn-outline-secondary"><i class="bi bi-download me-1"></i>Download</a>
</div>
{{if .IsImage}}<img src="{{.DataURI}}" alt="{{.Filename}}" class="img-fluid mt-2 border rounded" style="max-height: 400px;">{{end}}
</div>
{{end}}
</div>
</div>
{{end}}
{{if .log.legacy_attachments}}
<div class="card mb-3">
<div class="card-header"><strong>Saved attachment files</strong> <small class="text-muted">(from this sender/IP's "Store Full Message Content" setting)</small></div>
<div class="card-body">
<ul class="list-group">
{{range .log.legacy_attachments}}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div><i class="bi bi-paperclip me-1"></i>{{.Filename}} <small class="text-muted">({{filesize .Size}})</small></div>
<div class="btn-group" role="group">
<a href="/pymta-manager/msg/attachment/{{.ID}}/download" class="btn btn-sm btn-outline-primary" target="_blank" rel="noopener" title="Open in new tab"><i class="bi bi-box-arrow-up-right"></i> View</a>
<a href="/pymta-manager/msg/attachment/{{.ID}}/download?download=true" class="btn btn-sm btn-outline-secondary" title="Download file"><i class="bi bi-download"></i> Download</a>
<form method="POST" action="/pymta-manager/msg/attachment/{{.ID}}/delete" style="display: inline;" onsubmit="return confirm('Are you sure you want to delete this attachment?');">
<input type="hidden" name="csrf_token" value="{{$.csrf_token}}">
<button type="submit" class="btn btn-sm btn-outline-danger" title="Delete attachment"><i class="bi bi-trash"></i> Delete</button>
</form>
</div>
</li>
{{end}}
</ul>
</div>
</div>
{{end}}
<div class="card">
<div class="card-header"><strong>Message Content:</strong></div>
<div class="card-body">
{{if .log.has_content}}
{{if .log.html_body}}
<div class="p-2 border rounded bg-white text-dark">{{.log.html_body}}</div>
{{else if .log.plain_body}}
<pre style="white-space: pre-wrap; word-break: break-all;">{{.log.plain_body}}</pre>
{{else}}
<p class="text-muted mb-0">Message stored, but no readable body could be parsed out of it.</p>
{{end}}
{{else}}
<p class="text-muted mb-0"><i class="bi bi-shield-lock me-1"></i>Not stored, by design — the message content is only kept in this log when the sender/IP has "Store Full Message Content" enabled, or the message was quarantined as spam. Headers below are always kept.</p>
{{end}}
</div>
</div>
<div class="card mt-3">
<div class="card-header"><strong>Message Headers:</strong></div>
<div class="card-body"><pre style="white-space: pre-wrap;">{{.log.email_headers}}</pre></div>
</div>
{{end}}