473,385 Members | 1,898 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Determine Default Email Sender?

I'm writing a simple EXE in VB.NET to be run on our intranet (Win2K network,
XP machines). When it's done running I want to notify the user via email.
I've got the email working...how do I ascertain the user's default email
address without user interaction? There is only one user per machine, and we
are all using Outlook or Outlook Express.

Thanks.
Nov 21 '05 #1
3 2079
Hi Jason!

I don't know if this will help you but i thought i could share it anyway...

check this registry key out :
HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts

i've 2 account (shown as reg keys) named "00000001" and "00000002".
the first one (00000001) is for my hotmail account.
there is a value in there named "SMTP Email Address" which is my email
address.
if you don't find anything much information here about this you might want
to visit the different Outlook groups out there and ask them where this kind
of information could be find.

--
Best Regards
Yanick

"Jason" <so*****@microsoft.com> a écrit dans le message de
news:eN**************@tk2msftngp13.phx.gbl...
I'm writing a simple EXE in VB.NET to be run on our intranet (Win2K network, XP machines). When it's done running I want to notify the user via email.
I've got the email working...how do I ascertain the user's default email
address without user interaction? There is only one user per machine, and we are all using Outlook or Outlook Express.

Thanks.

Nov 21 '05 #2
Jason,

You can collect those adresses in a database on your Lan and use as key for
that the environment.username.

I hope this helps,

Cor
Nov 21 '05 #3
Hi

I wrote a function that returns the default e-mail address (smtp) from the
registry

Add this import:

Imports Microsoft.Win32

Function:

Private Function GetDefaultEmail() As String
Dim strkey As String = "Software\Microsoft\Internet Account Manager"
Dim reg As RegistryKey
Dim regDefaultAccount As RegistryKey
Dim strTemp As String
Dim strAccountNumber As Integer
reg = Registry.CurrentUser.OpenSubKey(strkey, False)
strAccountNumber = reg.GetValue("Default Mail Account")
reg.Close()
regDefaultAccount = Registry.CurrentUser.OpenSubKey(strkey &
"\Accounts\" & String.Format("{0:X8}", strAccountNumber), False)
strTemp = regDefaultAccount.GetValue("SMTP Email Address")
regDefaultAccount.Close()
If (Not strTemp Is Nothing) Then
Return strTemp
Else
Return ""
End If
End Function

Returns the default e-mail address or "" if the function fails

As you have noticed from above I returned the default account number as a
string, which on my machine would be just '1'. So, I needed a way to add the
zeros & using 'String.Format("{0:X8}", strAccountNumber)' does exactly that.
I am not sure if all the addresses held in the registry are in hex or
decimal. If they are decimal then you could format it like so:

String.Format("{0:D8}", strAccountNumber) '

I hope this helps

"Zoury" wrote:
Hi Jason!

I don't know if this will help you but i thought i could share it anyway...

check this registry key out :
HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts

i've 2 account (shown as reg keys) named "00000001" and "00000002".
the first one (00000001) is for my hotmail account.
there is a value in there named "SMTP Email Address" which is my email
address.
if you don't find anything much information here about this you might want
to visit the different Outlook groups out there and ask them where this kind
of information could be find.

--
Best Regards
Yanick

"Jason" <so*****@microsoft.com> a écrit dans le message de
news:eN**************@tk2msftngp13.phx.gbl...
I'm writing a simple EXE in VB.NET to be run on our intranet (Win2K

network,
XP machines). When it's done running I want to notify the user via email.
I've got the email working...how do I ascertain the user's default email
address without user interaction? There is only one user per machine, and

we
are all using Outlook or Outlook Express.

Thanks.


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
2
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to...
7
by: Doru Roman | last post by:
Hi, What is the fastest way to evaluate manually the result in this case: int a, b, c; a = 255; b = 122; c = a & b; The only way I know is transforming each number into the binary value...
5
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
Is there any way to do the following: 1. Determine whether ClearType is enabled by the system (under Display Properties - Effects in WinXP). 2. Determine whether a font supports ClearType. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.