package email import ( "fmt" "io" ) type EmailMessage struct { To string Subject string Body string Attachments []EmailAttachment } type EmailAttachment struct { File io.Reader Title string } func (e EmailAttachment) ReadContent() ([]byte, error) { bts, err := io.ReadAll(e.File) if err != nil { return nil, fmt.Errorf("error loading attachment: %s", err) } return bts, nil }