MCPcopy Index your code
hub / github.com/coder/coder / validateToAddrs

Method validateToAddrs

coderd/notifications/dispatch/smtp.go:510–526  ·  view source on GitHub ↗
(to string)

Source from the content-addressed store, hash-verified

508}
509
510func (s *SMTPHandler) validateToAddrs(to string) ([]string, error) {
511 addrs, err := mail.ParseAddressList(to)
512 if err != nil {
513 return nil, xerrors.Errorf("parse 'to' addresses: %w", err)
514 }
515 if len(addrs) == 0 {
516 s.log.Warn(context.Background(), "no valid 'to' address(es) defined; some may be invalid", slog.F("defined", to))
517 return nil, ErrValidationNoToAddress
518 }
519
520 var out []string
521 for _, addr := range addrs {
522 out = append(out, addr.Address)
523 }
524
525 return out, nil
526}
527
528// smarthost retrieves the host/port defined and validates them.
529// Does not allow overriding.

Callers 1

dispatchMethod · 0.95

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected