Log partial email body read errors instead of silently ignoring

io.ReadAll errors are unlikely for short yes/no replies but worth
logging for diagnosability. Processing continues with whatever bytes
were read to remain resilient.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Harry Culpan 2026-06-30 18:44:33 -04:00
parent bda5ef1fcf
commit 3426d5ad3d

View file

@ -3,6 +3,7 @@ package email
import ( import (
"fmt" "fmt"
"io" "io"
"log"
"net/mail" "net/mail"
"strings" "strings"
@ -92,6 +93,9 @@ func fetchEmails(imapClient *client.Client) ([]Email, error) {
return result, err return result, err
} }
body, err := io.ReadAll(m.Body) body, err := io.ReadAll(m.Body)
if err != nil {
log.Printf("Warning: partial read of email body from %s: %s", fromAddress, err)
}
email := NewEmail( email := NewEmail(
[]string{toAddress}, []string{toAddress},