smarthost retrieves the host/port defined and validates them. Does not allow overriding. nolint:revive // documented.
()
| 529 | // Does not allow overriding. |
| 530 | // nolint:revive // documented. |
| 531 | func (s *SMTPHandler) smarthost() (string, string, error) { |
| 532 | smarthost := strings.TrimSpace(string(s.cfg.Smarthost)) |
| 533 | if smarthost == "" { |
| 534 | return "", "", ErrValidationNoSmarthost |
| 535 | } |
| 536 | |
| 537 | host, port, err := net.SplitHostPort(string(s.cfg.Smarthost)) |
| 538 | if err != nil { |
| 539 | return "", "", xerrors.Errorf("split host port: %w", err) |
| 540 | } |
| 541 | |
| 542 | return host, port, nil |
| 543 | } |
| 544 | |
| 545 | // hello retrieves the hostname identifying the SMTP server. |
| 546 | // Does not allow overriding. |