MCPcopy Create free account
hub / github.com/foxcpp/maddy / rcpt

Method rcpt

internal/endpoint/smtp/session.go:378–398  ·  view source on GitHub ↗
(ctx context.Context, to string, opts *smtp.RcptOptions)

Source from the content-addressed store, hash-verified

376}
377
378func (s *Session) rcpt(ctx context.Context, to string, opts *smtp.RcptOptions) error {
379 // INTERNATIONALIZATION: Do not permit non-ASCII addresses unless SMTPUTF8 is
380 // used.
381 if !address.IsASCII(to) && !s.opts.UTF8 {
382 return &exterrors.SMTPError{
383 Code: 553,
384 EnhancedCode: exterrors.EnhancedCode{5, 6, 7},
385 Message: "SMTPUTF8 is required for non-ASCII recipients",
386 }
387 }
388 cleanTo, err := address.CleanDomain(to)
389 if err != nil {
390 return &exterrors.SMTPError{
391 Code: 501,
392 EnhancedCode: exterrors.EnhancedCode{5, 1, 2},
393 Message: "Unable to normalize the recipient address",
394 }
395 }
396
397 return s.delivery.AddRcpt(ctx, cleanTo, *opts)
398}
399
400func (s *Session) Logout() error {
401 s.msgLock.Lock()

Callers 1

RcptMethod · 0.95

Calls 3

IsASCIIFunction · 0.92
CleanDomainFunction · 0.92
AddRcptMethod · 0.65

Tested by

no test coverage detected