This commit is contained in:
Chris Mann 2023-07-23 11:04:35 +02:00
parent a0f779d9e2
commit d749c615b3

View file

@ -65,9 +65,10 @@ func passwordLost(user User, config *ConfigFile, ldapConn *ldap.Conn) error {
// if config.SMTPUsername != "" { // if config.SMTPUsername != "" {
// auth = sasl.NewPlainClient("", config.SMTPUsername, config.SMTPPassword) // auth = sasl.NewPlainClient("", config.SMTPUsername, config.SMTPPassword)
// } // }
message := buf.Bytes()
auth := smtp.PlainAuth("", config.SMTPUsername, config.SMTPPassword, config.SMTPServer) auth := smtp.PlainAuth("", config.SMTPUsername, config.SMTPPassword, config.SMTPServer)
log.Printf("auth: %v", auth) log.Printf("auth: %v", auth)
err = smtp.SendMail(config.SMTPServer+":587", auth, config.SMTPUsername, []string{user.OtherMailbox}, buf) err = smtp.SendMail(config.SMTPServer+":587", auth, config.SMTPUsername, []string{user.OtherMailbox}, message)
if err != nil { if err != nil {
log.Printf("email send error %v", err) log.Printf("email send error %v", err)
return err return err