NS8 Nextcloud Incorrect Email Address from AD

I have a Samba directory set up with users added. I installed Nextcloud. Authentication works properly.

Nextcloud is showing user email addresses as username@ad.mydomain.com instead of username@mydomain.com in the contacts app. This also has implications when provisioning the email app.

The email addresses are shown correctly in SOGo.

Also… The last name field in Nextcloud is the the username in parenthesis, while the actual last name is in “Additional Name”

How can I fix this?

I set the email addresses of the users in RSAT tools.

In the Nextcloud LDAP settings, I set User Display Name Field to displayName, removed the value in 2nd User Display Name Field, and set the email field to mail.

This solved the problem for me.