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 != "" {
// auth = sasl.NewPlainClient("", config.SMTPUsername, config.SMTPPassword)
// }
message := buf.Bytes()
auth := smtp.PlainAuth("", config.SMTPUsername, config.SMTPPassword, config.SMTPServer)
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 {
log.Printf("email send error %v", err)
return err