Is there a way to get the user's email address from within Windows via Win32 or .NET? Is there a registry key or API that contains this information?
EDIT: I have an application that emails my company if our application fails and I wanted to get a return email address so that we could respond that individual that experienced the crash. I'm currently getting the username, but that may not match the email name. Obviously I can get the user to enter his email address, but the interface would be a little friendlier if I could at least attempt to acquire the email address and have the user verify that the return email address is correct.
The only way I can think that this would make sense is in a Windows Active Directory environment. In this case you can query AD and see if there's an email address associated with the user's account. This will definitely work with MS Exchange and may also work with other enterprise email systems. For .Net you can use the classes in the System.DirectoryServices namespace. For Win32 you can use the ADSI API. You will have to read up on AD and create a suitable query to match your requirements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With