Skip to content

Commit

Permalink
Added AUTH LOGIN capability
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars committed Sep 11, 2023
1 parent 71a2bd0 commit 1946870
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,19 @@ func main() {
s.MaxMessageBytes = config.Server.MaxMessageSizeMb * 1024 * 1024
s.MaxRecipients = config.Server.MaxRecipients
s.AllowInsecureAuth = config.Server.AllowInsecure

s.EnableAuth(sasl.Login,
func(conn *smtp.Conn) sasl.Server {
return sasl.NewLoginServer(func(username, password string) error {
sess := conn.Session()
if sess == nil {
panic("No session when AUTH is called")
}

return sess.AuthPlain(username, password)
})
},
)
s.AuthDisabled = false
s.TLSConfig = tlsc

Expand Down

0 comments on commit 1946870

Please sign in to comment.