tags:

views:

295

answers:

6

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.

+3  A: 

Have you saved your e-mail address somewhere in the system? There is no standard place to look for. I always depends on the applications the user uses (Outlook, Outlook Express, TuhunderBird).

The best way to get the users e-mail address is to ask him.

Eduard Wirch
+3  A: 

Let me answer you by asking you this: Did you ever enter your email address when installing windows?

SQLMenace
No, of course not. But you do enter it when you setup your Outlook and Thunderbird accounts.
Michael Kelley
A: 

Email addresses could be for web-based clients like gmail or they could be domain email addresses. Either way the implementation would have to be based on the specifics of the user's email setup. So the short answer is "no", at least there's no "one-size-fits-all" method.

David Morton
A: 

There may be SOME email address stored within Windows, but for you to get a user's actual email address, you have to have them type it in, and to assure it, you have to handshake by sending them an activate email before you use it.

tkotitan
+2  A: 

I think the simple answer is no ... but of course the email address will be stored in their email program such as Outlook.

What is it you are trying to achieve?

Stephen Baugh
+5  A: 

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.

Stu Mackellar