I wondered how I could retrieve the email address from ldap which is not stored in the same entry.
You might have to extend the UserAdapter class and override the getEmail getter for this. You can refer some examples of this here.
I wouldn’t reference my custom implementation as an example when it comes to LDAP providers. The LDAP provider is way more complex.
For LDAP, there are mappers which define, from where to get the data. I’d recommend to look into the mappers. Most probably, you’d have to implement a custom LDAP mapper to retrieve the custom email attribute from a separate query.