recipientCountError returns a too_many_recipients envelope when the combined to+cc+bcc count exceeds maxRecipients, else nil.
(groups ...[]string)
| 78 | // recipientCountError returns a too_many_recipients envelope when the combined |
| 79 | // to+cc+bcc count exceeds maxRecipients, else nil. |
| 80 | func recipientCountError(groups ...[]string) *ErrorEnvelope { |
| 81 | total := 0 |
| 82 | for _, g := range groups { |
| 83 | total += len(g) |
| 84 | } |
| 85 | if total > maxRecipients { |
| 86 | return NewError(http.StatusBadRequest, "too_many_recipients", |
| 87 | "too many recipients — at most 50 across to, cc and bcc combined"). |
| 88 | WithDetails(map[string]any{"max_recipients": maxRecipients, "provided": total}) |
| 89 | } |
| 90 | return nil |
| 91 | } |
| 92 | |
| 93 | // SendEmailRequest is the new-thread send body. to/subject/body are required |
| 94 | // (MSG-3): RFC 5321 requires ≥1 recipient (From/Date are server-set), and a |
no test coverage detected