Render inbound email HTML body in admin inbox

Worker now extracts both text/plain and text/html MIME parts and sends
htmlBody in the webhook payload. Server stores it on the submission.
Admin inbox renders htmlBody in a sandboxed iframe when present, falling
back to plain text with whitespace preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
nmemmert
2026-06-30 11:32:52 -04:00
parent 4b411f763f
commit 118314d0d7
3 changed files with 33 additions and 16 deletions
+15 -1
View File
@@ -628,6 +628,7 @@ interface ContactSubmission {
archived?: boolean
source?: 'contact-form' | 'download' | 'inbound-email'
inboundTo?: string
htmlBody?: string | null
}
interface ContactReplyDraft {
@@ -5051,7 +5052,20 @@ export default function AdminPage({ content, onSave, onLogout }: Props) {
</div>
<div className="admin-email-body">
<p>{selected.message}</p>
{selected.htmlBody ? (
<iframe
srcDoc={selected.htmlBody}
sandbox="allow-same-origin"
style={{ width: '100%', minHeight: '320px', border: 'none', background: '#fff', borderRadius: '4px' }}
onLoad={e => {
const iframe = e.currentTarget
const h = iframe.contentDocument?.documentElement?.scrollHeight
if (h) iframe.style.height = `${h}px`
}}
/>
) : (
<p style={{ whiteSpace: 'pre-wrap' }}>{selected.message}</p>
)}
</div>
<div className="admin-actions admin-actions--maintenance">