From c509641f59bb58575c501323d3a7355d8320bd41 Mon Sep 17 00:00:00 2001 From: Harry Culpan Date: Tue, 30 Jun 2026 18:29:05 -0400 Subject: [PATCH] Guard against empty From header in IMAP message fetch Bounce messages and MAILER-DAEMON notices can have no From address, causing a panic on the bare [0] index access. Co-Authored-By: Claude Sonnet 4.6 --- pkg/email/fetch.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/email/fetch.go b/pkg/email/fetch.go index 57bbb34..c338cc5 100644 --- a/pkg/email/fetch.go +++ b/pkg/email/fetch.go @@ -74,6 +74,9 @@ func fetchEmails(imapClient *client.Client) ([]Email, error) { }() for msg := range messages { + if len(msg.Envelope.From) == 0 { + continue + } toAddress := concatAddresses(msg.Envelope.To) fromAddress := msg.Envelope.From[0].Address() r := msg.GetBody(section)