473,657 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.NET get mail server

Is there a registry setting that I can read in vb.net for windows platforms
that will give me the default mail server for the computer (e.g.
mail.charter.ne t)
Nov 20 '05 #1
42 3517
Never mind I found it.

"scorpion53 061" <sc************ @yahoo.com> wrote in message
news:OR******** ******@TK2MSFTN GP10.phx.gbl...
Is there a registry setting that I can read in vb.net for windows platforms that will give me the default mail server for the computer (e.g.
mail.charter.ne t)

Nov 20 '05 #2
Cor
Hi Scorpion,
Yes and what was it, if I had known it I had told you so contribute it
please
:-)
Cor
Nov 20 '05 #3
I am rewriting the code will post it shortly.......

"Cor" <no*@non.com> wrote in message
news:OG******** ******@tk2msftn gp13.phx.gbl...
Hi Scorpion,
Yes and what was it, if I had known it I had told you so contribute it
please
:-)
Cor

Nov 20 '05 #4
Cor,
This will work but I am sure it will only work on my machine. Do you have
any idea on how to make this work on other machines?

Try
regKey =
Registry.Users. OpenSubKey("S-1-5-21-1343024091-706699826-854245398-500\Softw
are\Microsoft\I nternet Account Manager\Account s\00000001", True)
ver = regKey.GetValue ("SMTP Server")
MsgBox(ver)

Catch ex As Exception
MsgBox(ex.ToStr ing)
regKey.Close()
Exit Sub
End Try
regKey.Close()
Exit Sub

"Cor" <no*@non.com> wrote in message
news:OG******** ******@tk2msftn gp13.phx.gbl...
Hi Scorpion,
Yes and what was it, if I had known it I had told you so contribute it
please
:-)
Cor

Nov 20 '05 #5
I think the answer is to loop through USER and find the value of "SMTP
Server" and then grab its value.
I will try to write this........if anyone wants to help please jump in......

"scorpion53 061" <sc************ @yahoo.com> wrote in message
news:OM******** ******@tk2msftn gp13.phx.gbl...
Cor,
This will work but I am sure it will only work on my machine. Do you have
any idea on how to make this work on other machines?

Try
regKey =
Registry.Users. OpenSubKey("S-1-5-21-1343024091-706699826-854245398-500\Softw are\Microsoft\I nternet Account Manager\Account s\00000001", True)
ver = regKey.GetValue ("SMTP Server")
MsgBox(ver)

Catch ex As Exception
MsgBox(ex.ToStr ing)
regKey.Close()
Exit Sub
End Try
regKey.Close()
Exit Sub

"Cor" <no*@non.com> wrote in message
news:OG******** ******@tk2msftn gp13.phx.gbl...
Hi Scorpion,
Yes and what was it, if I had known it I had told you so contribute it
please
:-)
Cor


Nov 20 '05 #6
Will this code return the smtp server on Windows 98, Me, 2000?
Any other things I should know?
Try
regKey =
Registry.Curren tUser.OpenSubKe y("Software\Mic rosoft\Internet Account
Manager\Account s\00000001", True)
ver = regKey.GetValue ("SMTP Server")
MsgBox(ver)
Exit Sub
Catch ex As Exception
MsgBox(ex.ToStr ing)
regKey.Close()
Exit Sub
End Try
regKey.Close()
Exit Sub
"Cor" <no*@non.com> wrote in message
news:OG******** ******@tk2msftn gp13.phx.gbl...
Hi Scorpion,
Yes and what was it, if I had known it I had told you so contribute it
please
:-)
Cor

Nov 20 '05 #7
Hi Scorpion,

When I looked in my registry under
HKCU\Software\M icrosoft\Intern et Account Manager\Account s\
I found 00000007, 8, 9 etc, but no 00000001.

The earlier ones were deleted. Of the ones that are there, some are for
mail and some are for news.

The good news is that there is a key
HKCU\....\Inter net Account Manager\Default Mail Account
which gives the account number as a string. In my case it's 00000007.

The code below worked for me (on Win2000).
Perhaps some others could try it out.

Regards,
Fergus

<code>
Dim regKey As RegistryKey
Dim sSmtpServer As String
Try
regKey = Registry.Curren tUser.OpenSubKe y _
("Software\Micr osoft\Internet Account Manager", False)
Dim sMailAccount As String _
= regKey.GetValue ("Default Mail Account")
regKey.Close()

regKey = Registry.Curren tUser.OpenSubKe y _
("Software\Micr osoft\Internet Account Manager" _
& "\Accounts\ " & sMailAccount, False)
sSmtpServer = regKey.GetValue ("SMTP Server")

Catch ex As Exception
MsgBox(ex.ToStr ing)
Finally
If Not regKey Is Nothing Then _
regKey.Close()
End Try
</code>
Nov 20 '05 #8
Fergus,
You were dead on balls accurate here. ......:) Thank you for your help.....

"Fergus Cooney" <fi*****@post.c om> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
Hi Scorpion,

When I looked in my registry under
HKCU\Software\M icrosoft\Intern et Account Manager\Account s\
I found 00000007, 8, 9 etc, but no 00000001.

The earlier ones were deleted. Of the ones that are there, some are for mail and some are for news.

The good news is that there is a key
HKCU\....\Inter net Account Manager\Default Mail Account
which gives the account number as a string. In my case it's 00000007.

The code below worked for me (on Win2000).
Perhaps some others could try it out.

Regards,
Fergus

<code>
Dim regKey As RegistryKey
Dim sSmtpServer As String
Try
regKey = Registry.Curren tUser.OpenSubKe y _
("Software\Micr osoft\Internet Account Manager", False)
Dim sMailAccount As String _
= regKey.GetValue ("Default Mail Account")
regKey.Close()

regKey = Registry.Curren tUser.OpenSubKe y _
("Software\Micr osoft\Internet Account Manager" _
& "\Accounts\ " & sMailAccount, False)
sSmtpServer = regKey.GetValue ("SMTP Server")

Catch ex As Exception
MsgBox(ex.ToStr ing)
Finally
If Not regKey Is Nothing Then _
regKey.Close()
End Try
</code>

Nov 20 '05 #9
Cor
Hi Fergus,
It works as a fish in the water,
Four little changes, not real in the code, but if you want to show it
others, I think you tested it in the debugger.

<code> imports microsoft.win32
.... Dim regKey As RegistryKey
Dim sSmtpServer As String
Try
regKey = Registry.Curren tUser.OpenSubKe y _
("Software\Micr osoft\Internet Account Manager", False)
Dim sMailAccount As String _
= regKey.GetValue ("Default Mail Account") ..toString regKey.Close()

regKey = Registry.Curren tUser.OpenSubKe y _
("Software\Micr osoft\Internet Account Manager" _
& "\Accounts\ " & sMailAccount, False)
sSmtpServer = regKey.GetValue ("SMTP Server") ..toString
messagebox.show (sSmtp.Server)
Catch ex As Exception
MsgBox(ex.ToStr ing)
Finally
If Not regKey Is Nothing Then _
regKey.Close()
End Try
</code>

Nice it is in my snippets
Cor
Nov 20 '05 #10

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

Similar topics

6
11175
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I will include the code I originally used. I understand I should switch from CDONTS to CDO mail but after several sttempts I am finding a very hard time getting the new CDO mail to work properly. Any assistance with this would be greatly...
8
5463
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
5
2495
by: Charlie | last post by:
Hi: I'm working on an e-commerce site. Using the SMTP class, my site sends out confirmation messages. It works most of the time, but sometimes raises an error. I need a way of making sure it goes out every time. I thought about wrapping a try-catch handler in loop that keeps on retrying if delivery fails. Is this a good idea? If not, what is the best way of handling this kind of thing? Thanks,
3
3025
by: RN | last post by:
I am tired of sending mail from the built-in SMTP service for so many reasons (errors are nondescriptive in the event log, it doesn't let me control which IP address it sends from, and it identifies itself as the computer name which is not in domain.com format, triggering spam filter problems). Instead, I want to have my code send through an SMTP server of a company that we pay for mail service. But they require a username and password....
9
3213
by: B-Dog | last post by:
I've built a small app that sends mail through our ISP's SMTP server but when I try to send through my local exchange server I get CDO error. Does webmail use SMTP or does it strictly rely on CDOmail. I don't want to use the Outlook reference because outlook prompts each time program access it and I have found a way to disable that. Can I use webmail with exchange? Thanks
34
18222
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow "127.0.0.1". 4. Authentication: "Anonymous access" only. 5. Outbound connection listen to TCP 25. Besides,
6
2523
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario, I'm having trouble writing to the server's event log. Here's some details: Server and workstation both in the same workgroup Logged into server as local Administrator Logged into workstation as a local user that is only in the Users group on
8
1996
by: Robert Dufour | last post by:
Dim message As New MailMessage("mymail@mydomain.com", "mymail@mydomain.com", "Test", "Test") Dim emailClient As New SmtpClient("localhost") emailClient.Send(message) The IIS server is running on the local machine. What am I missing to make this work reliably?
4
1751
by: =?Utf-8?B?UmljaA==?= | last post by:
I want to build an simple email smtp client app similar to outlook except with some custom features for a personal computer that uses comcast cable. The owner of the computer said she doesn't have a comcast email and uses gmail instead, but the internet service provider is comcast. This computer also does not have MS Office loaded - otherwise I would open Outlook and see what mail server it is using. On my development machine at my...
0
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7333
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4315
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2731
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.