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 <noreply@anthropic.com>
This commit is contained in:
parent
2d6436dca6
commit
c509641f59
1 changed files with 3 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue