Skip to content

Commit 03b932c

Browse files
committed
fix: handle empty inbox email address in fetchAndProcessMessages
1 parent 012de05 commit 03b932c

File tree

1 file changed

+4
-0
lines changed
  • internal/inbox/channel/email

1 file changed

+4
-0
lines changed

internal/inbox/channel/email/imap.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ func (e *Email) fetchAndProcessMessages(ctx context.Context, client *imapclient.
162162
e.lo.Error("failed to extract email address from the 'From' header", "error", err)
163163
return fmt.Errorf("failed to extract email address from 'From' header: %w", err)
164164
}
165+
if inboxEmail == "" {
166+
e.lo.Error("inbox email address is empty, cannot process messages", "inbox_id", e.Identifier())
167+
return fmt.Errorf("inbox (%d) email address is empty, cannot process messages", e.Identifier())
168+
}
165169
for {
166170
// Check for context cancellation before fetching the next message.
167171
select {

0 commit comments

Comments
 (0)