(groups ...[]string)
| 1521 | func ValidateRecipients(groups ...[]string) error { return validateRecipients(groups...) } |
| 1522 | |
| 1523 | func validateRecipients(groups ...[]string) error { |
| 1524 | for _, group := range groups { |
| 1525 | for _, addr := range group { |
| 1526 | if addr == "" { |
| 1527 | return errors.New("recipient address must not be empty") |
| 1528 | } |
| 1529 | if _, err := mail.ParseAddress(addr); err != nil { |
| 1530 | return fmt.Errorf("invalid recipient %q: %w", addr, err) |
| 1531 | } |
| 1532 | } |
| 1533 | } |
| 1534 | return nil |
| 1535 | } |
| 1536 | |
| 1537 | // validateDomain runs the IDNA "Lookup" profile against a user-supplied |
| 1538 | // domain string. Lookup is the strictest of the four IDNA profiles and |
no outgoing calls