MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / normalizeAddrs

Function normalizeAddrs

internal/outbound/sender.go:337–351  ·  view source on GitHub ↗

normalizeAddrs parses and lowercases a list of email addresses. Returns an error if any address is unparseable.

(addrs []string)

Source from the content-addressed store, hash-verified

335// normalizeAddrs parses and lowercases a list of email addresses.
336// Returns an error if any address is unparseable.
337func normalizeAddrs(addrs []string) ([]string, error) {
338 out := make([]string, 0, len(addrs))
339 for _, a := range addrs {
340 a = strings.TrimSpace(a)
341 if a == "" {
342 continue
343 }
344 parsed, err := mail.ParseAddress(a)
345 if err != nil {
346 return nil, fmt.Errorf("%q: %w", a, err)
347 }
348 out = append(out, strings.ToLower(parsed.Address))
349 }
350 return out, nil
351}
352
353// removeAddrs removes any address in exclude from addrs (case-insensitive).
354func removeAddrs(addrs []string, exclude []string) []string {

Callers 4

SendMethod · 0.85
TestNormalizeAddrsFunction · 0.85

Calls 1

makeFunction · 0.85

Tested by 3

TestNormalizeAddrsFunction · 0.68