Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Acquire a user's email address?

Tags:

email

windows

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.

like image 873
Michael Kelley Avatar asked Jan 28 '09 20:01

Michael Kelley


1 Answers

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.

like image 129
Stu Mackellar Avatar answered Sep 19 '22 19:09

Stu Mackellar