Browse Source

Fix anonymous login

develop
wpetit 1 year ago
parent
commit
f2530bf390
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      cmd/fake-smtp/smtp.go

+ 8
- 1
cmd/fake-smtp/smtp.go View File

@ -43,7 +43,9 @@ func (b *Backend) AnonymousLogin(state *smtp.ConnectionState) (smtp.Session, err
return nil, smtp.ErrAuthRequired
}
return nil, nil
ctx := context.WithValue(context.Background(), container.KeyServiceContainer, b.ctn)
return &Session{ctx, b.ctn, "anonymous"}, nil
}
// A Session is returned after successful login.
@ -105,6 +107,11 @@ func startSMTPServer(conf *config.Config, ctn *service.Container) {
s.MaxMessageBytes = conf.SMTP.MaxMessageBytes
s.MaxRecipients = conf.SMTP.MaxRecipients
s.AllowInsecureAuth = conf.SMTP.AllowInsecureAuth
if conf.SMTP.Username == "" && conf.SMTP.Password == "" {
s.AuthDisabled = true
}
if conf.SMTP.Debug {
s.Debug = os.Stdout
}


Loading…
Cancel
Save