By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,481 Members | 1,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,481 IT Pros & Developers. It's quick & easy.

VB.NET get mail server

P: n/a
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.net)
Nov 20 '05 #1
Share this Question
Share on Google+
42 Replies


P: n/a
Never mind I found it.

"scorpion53061" <sc************@yahoo.com> wrote in message
news:OR**************@TK2MSFTNGP10.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.net)

Nov 20 '05 #2

P: n/a
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

P: n/a
I am rewriting the code will post it shortly.......

"Cor" <no*@non.com> wrote in message
news:OG**************@tk2msftngp13.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

P: n/a
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\Internet Account Manager\Accounts\00000001", True)
ver = regKey.GetValue("SMTP Server")
MsgBox(ver)

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

"Cor" <no*@non.com> wrote in message
news:OG**************@tk2msftngp13.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

P: n/a
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......

"scorpion53061" <sc************@yahoo.com> wrote in message
news:OM**************@tk2msftngp13.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\Internet Account Manager\Accounts\00000001", True)
ver = regKey.GetValue("SMTP Server")
MsgBox(ver)

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

"Cor" <no*@non.com> wrote in message
news:OG**************@tk2msftngp13.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

P: n/a
Will this code return the smtp server on Windows 98, Me, 2000?
Any other things I should know?
Try
regKey =
Registry.CurrentUser.OpenSubKey("Software\Microsof t\Internet Account
Manager\Accounts\00000001", True)
ver = regKey.GetValue("SMTP Server")
MsgBox(ver)
Exit Sub
Catch ex As Exception
MsgBox(ex.ToString)
regKey.Close()
Exit Sub
End Try
regKey.Close()
Exit Sub
"Cor" <no*@non.com> wrote in message
news:OG**************@tk2msftngp13.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

P: n/a
Hi Scorpion,

When I looked in my registry under
HKCU\Software\Microsoft\Internet Account Manager\Accounts\
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\....\Internet 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.CurrentUser.OpenSubKey _
("Software\Microsoft\Internet Account Manager", False)
Dim sMailAccount As String _
= regKey.GetValue ("Default Mail Account")
regKey.Close()

regKey = Registry.CurrentUser.OpenSubKey _
("Software\Microsoft\Internet Account Manager" _
& "\Accounts\" & sMailAccount, False)
sSmtpServer = regKey.GetValue ("SMTP Server")

Catch ex As Exception
MsgBox(ex.ToString)
Finally
If Not regKey Is Nothing Then _
regKey.Close()
End Try
</code>
Nov 20 '05 #8

P: n/a
Fergus,
You were dead on balls accurate here. ......:) Thank you for your help.....

"Fergus Cooney" <fi*****@post.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi Scorpion,

When I looked in my registry under
HKCU\Software\Microsoft\Internet Account Manager\Accounts\
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\....\Internet 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.CurrentUser.OpenSubKey _
("Software\Microsoft\Internet Account Manager", False)
Dim sMailAccount As String _
= regKey.GetValue ("Default Mail Account")
regKey.Close()

regKey = Registry.CurrentUser.OpenSubKey _
("Software\Microsoft\Internet Account Manager" _
& "\Accounts\" & sMailAccount, False)
sSmtpServer = regKey.GetValue ("SMTP Server")

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

Nov 20 '05 #9

P: n/a
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.CurrentUser.OpenSubKey _
("Software\Microsoft\Internet Account Manager", False)
Dim sMailAccount As String _
= regKey.GetValue ("Default Mail Account") ..toString regKey.Close()

regKey = Registry.CurrentUser.OpenSubKey _
("Software\Microsoft\Internet Account Manager" _
& "\Accounts\" & sMailAccount, False)
sSmtpServer = regKey.GetValue ("SMTP Server") ..toString
messagebox.show(sSmtp.Server)
Catch ex As Exception
MsgBox(ex.ToString)
Finally
If Not regKey Is Nothing Then _
regKey.Close()
End Try
</code>

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

P: n/a
Cor I didnt see anything change what did you change?

One thing I observed on some of my Windows 98 machines here at work (we use
groupwise for an email client) is that the value "Default Mail Account"
didnt exist. I am assuming that an SMTP Server then would not exist would
you agree? I handled it in the Catch and Finally but......

If a user used Outlook and never used Outlook Express do you suppose the
values would be the same under "Default Mail Server". The reason I ask is I
noticed it listed my Outlook Express email and not my Outlook information
though it is my "default" email account.
"Cor" <no*@non.com> wrote in message
news:Oa**************@TK2MSFTNGP09.phx.gbl...
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.CurrentUser.OpenSubKey _
("Software\Microsoft\Internet Account Manager", False)
Dim sMailAccount As String _
= regKey.GetValue ("Default Mail Account")

.toString
regKey.Close()

regKey = Registry.CurrentUser.OpenSubKey _
("Software\Microsoft\Internet Account Manager" _
& "\Accounts\" & sMailAccount, False)
sSmtpServer = regKey.GetValue ("SMTP Server")

.toString
messagebox.show(sSmtp.Server)

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

Nice it is in my snippets
Cor

Nov 20 '05 #11

P: n/a
Hi Cor,

I have a whole pile of Imports from all the snippet development so
sometimes I forget to copy them out. And Option Strict On had been commented
out for something else and left that way. Oops! ;-)

Cheers for the additions.

Regards,
Fergus
Nov 20 '05 #12

P: n/a
Hi Scorpion,

Cor added the Imports, which you already have. He also added .ToString to
my GetValue()s which is necessary when you have Option Strict On. (You don't
use it, I believe, so the call to ToString would get done through
late-binding).

He also put back the MsgBox which I hadn't shown (my version was a
function and the caller did the showing).

Unfortunately I don't know Windows 98 and don't use Outlook (2000) for my
email so I can't answer the important questions.

Regards,
Fergus
Nov 20 '05 #13

P: n/a
That i s ok. I am thinking of just making it a requirement that IIS be
installed to use the program. That will solve the issue I think.

You done great.
"Fergus Cooney" <fi*****@post.com> wrote in message
news:ud**************@tk2msftngp13.phx.gbl...
Hi Scorpion,

Cor added the Imports, which you already have. He also added .ToString to my GetValue()s which is necessary when you have Option Strict On. (You don't use it, I believe, so the call to ToString would get done through
late-binding).

He also put back the MsgBox which I hadn't shown (my version was a
function and the caller did the showing).

Unfortunately I don't know Windows 98 and don't use Outlook (2000) for my email so I can't answer the important questions.

Regards,
Fergus

Nov 20 '05 #14

P: n/a
well I got my butt roundly kicked by my coworkers because if the user has a
email account other than Outlook Express or possibly Outlook it will not
pick up the SMTP Server.
Any thoughts on this?
(By the way they didnt have ANY suggestions to contribute.)

"Fergus Cooney" <fi*****@post.com> wrote in message
news:u2**************@tk2msftngp13.phx.gbl...
Hi Cor,

I have a whole pile of Imports from all the snippet development so
sometimes I forget to copy them out. And Option Strict On had been commented out for something else and left that way. Oops! ;-)

Cheers for the additions.

Regards,
Fergus

Nov 20 '05 #15

P: n/a
Hi Scorpion,

|| well I got my butt roundly kicked by ...
|| Any thoughts on this?

Are there any friendly young ladies handy with the massage oil?
|| (By the way they didnt have ANY suggestions to contribute.)

Of course not, that would be too helpful. ;-)

What others are they talking about? Is there any chance of getting hold of
one these and installing it with Windows on a nice new partition (ie. no
Outlook and an uncluttered Registry) and seeing what it puts in the Registry?

Regards,
Fergus
Nov 20 '05 #16

P: n/a
basically what they are saying is any other email client besides Outlook
Express this will not work with.

No unfortunately they are all guys and to be honest they are all very much
the anti - .NET. I am the lone .NET guy here and it can cause some friction
at times. But they usually are a good group of guys.

I did some checking on the new computers here.

None of the XP machines had IIS automatically installed (we only buy Pro) .
None had a default email server key. After the install of that the values as
we have them currently coded appear though they are empty.

I intialized the Outlook Express install and the values were filled with
what I entered in the wizard.

I didnt have a copy of Office I could use to to test with Outlook.

I have a feeling they are right ......... :(
"Fergus Cooney" <fi*****@post.com> wrote in message
news:OB****************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

|| well I got my butt roundly kicked by ...
|| Any thoughts on this?

Are there any friendly young ladies handy with the massage oil?
|| (By the way they didnt have ANY suggestions to contribute.)

Of course not, that would be too helpful. ;-)

What others are they talking about? Is there any chance of getting hold of one these and installing it with Windows on a nice new partition (ie. no
Outlook and an uncluttered Registry) and seeing what it puts in the Registry?
Regards,
Fergus

Nov 20 '05 #17

P: n/a
This is the email the senior guy here sent me today. He was a little on the
crabby side.................

(There is no such thing as one or even any default location. No Windows
operating system requires a user to define a default smtp server and there
is
no default location in the registry for such information to be stored when
the
user does define a default smtp server.

HKCU\Software\Microsoft\Internet Account Manager\Accounts is the default
where:
a) the user is using Outlook Express,
b) has configured an smtp server,
c) is using the default identity,
d) has made no changes to the keys used by Outlook Express.
This is regardless of the operating system in use be it Win 98, Win Me, XP,
Win 2K or Win Server 2003. So if those conditions will be met then you're
OK.

Therefore you need to consider those who:
a) Use Hotmail, Yahoo or other web based e-mail,
b) Use another mail client such as Agent, Pegasus or Eudora. For example
Agent
stores the information in the file AGENT.INI in the Agent message store. I
don't currently have a PC here with Outlook installed so cannot check for
you
where Outlook stores this information.
c) Use Outlook Express but no longer use the original default identity in
which case the account information is held in the key
HKCU\Identities\{CLSID}\Software\Microsoft\Interne t Account Manager\Accounts
In my case although I have only a single identity I use the above key rather
than that in HKCU\Software as this enables me to transfer the account
information together with that for the rest of Outlook Express from
operating
system instance to instance and between machines as and when required. The
same is true of many other beta testers.

I realise that I have barely scratched the surface of the various
possibilities. I hope that if nothing else this thread has made you think
again about
how a simple question doesn't always have a simple answer and that there can
often be a number of different answers.)

"Fergus Cooney" <fi*****@post.com> wrote in message
news:OB****************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

|| well I got my butt roundly kicked by ...
|| Any thoughts on this?

Are there any friendly young ladies handy with the massage oil?
|| (By the way they didnt have ANY suggestions to contribute.)

Of course not, that would be too helpful. ;-)

What others are they talking about? Is there any chance of getting hold of one these and installing it with Windows on a nice new partition (ie. no
Outlook and an uncluttered Registry) and seeing what it puts in the Registry?
Regards,
Fergus

Nov 20 '05 #18

P: n/a
Hi Scorpion,

Something of a heavy blow there. Just the first point - a) web-based
email - throws a major spanner in the works!

Whoever gave you that bit of the spec is going to have to rethink their
requirement. You can create miracles - but not a galaxy of them.

Good luck on this one - and better lucj on the next task. ;-)

Regards,
Fergus
Nov 20 '05 #19

P: n/a
yeah I would be just satisfied with those with POP3 accounts of being
certain I would get their defaults correctly.
I think I am going to go ask the boss if he will let me just ask the user
and store the value in a xml file.
I have spent way too much time on this........
"Fergus Cooney" <fi*****@post.com> wrote in message
news:Oo*************@TK2MSFTNGP10.phx.gbl...
Hi Scorpion,

Something of a heavy blow there. Just the first point - a) web-based
email - throws a major spanner in the works!

Whoever gave you that bit of the spec is going to have to rethink their requirement. You can create miracles - but not a galaxy of them.

Good luck on this one - and better lucj on the next task. ;-)

Regards,
Fergus

Nov 20 '05 #20

P: n/a
Fergus,

Do you have an idea of how one might programmatically search for a "SMTP
Server" subkey through the entire registry?
If we can do this, then it will not matter what email client the user
has.....

"Fergus Cooney" <fi*****@post.com> wrote in message
news:Oo*************@TK2MSFTNGP10.phx.gbl...
Hi Scorpion,

Something of a heavy blow there. Just the first point - a) web-based
email - throws a major spanner in the works!

Whoever gave you that bit of the spec is going to have to rethink their requirement. You can create miracles - but not a galaxy of them.

Good luck on this one - and better lucj on the next task. ;-)

Regards,
Fergus

Nov 20 '05 #21

P: n/a
Hi Scorpion,

I sure do!! Work on something else today and watch this space. ;-))

Coming soon to a thread near you:

Public Class RegistrySearch (sValueName As String)

Regards,
Fergus
Nov 20 '05 #22

P: n/a
Hi again Scorpion,

Cor has just asked me <why> you want the SMTP Server info. And, you know,
I haven't asked you yet! So what's the question behind the question, as it
were?

Regards,
Fergus
Nov 20 '05 #23

P: n/a
Is Cor suspicious of me? That is ok I probably would be too......

Out customer software (which I built as I take a bow :) None of the other
guys in my office could do it) in the past has used a smtp mailer to do
confirmation of orders with our customers and to provide email back and
forth between the various departments at my company and the customer.

(This software also provides pricing, stock status and order entry in real
time on an AIX server for those of you wondering what else it does.........)

I always had the user enter the information and it was saved to an XML file
and retrieved when the program started up.

The only problem with that is a lot of the customers (we area plumbing and
electrical distribution company) are well not knowledgeable when it comes to
these things. So the boss wanted the program to automatically detect their
smtp information. Of course I said I could do it thinking a simple registry
query would work.

But little did I know.......

If you have any doubts as to my intentions do this.....
http://www.jjkoepsell.com/downloads.html and download the software it is at
the bottom of the page called "JJ Koepsell Customer Software" or click here
to start the install
(http://63.252.11.73/softdownloads/JJ...20Software.exe)

After doing so email me (ad***@nospamremovejjkoepsell.com ) and I will send
you a username and password. Actually it would be fun to have you guys do
this and pick on me for everything I have done wrong in this application. :)

"Fergus Cooney" <fi*****@post.com> wrote in message
news:uy**************@TK2MSFTNGP11.phx.gbl...
Hi again Scorpion,

Cor has just asked me <why> you want the SMTP Server info. And, you know, I haven't asked you yet! So what's the question behind the question, as it
were?

Regards,
Fergus

Nov 20 '05 #24

P: n/a
Cor
Hi Scorpion,

I was not suspicious, Fergus did not tell you, but in another thread Fergus
said he was very busy with your problem.

I saw this thread, (I followed it more than you know) and I saw nothing in
it which described your problem, and I thought, maybe there is another way
to get an solution.

I did tell that to Fergus, and he said, you are right, normaly I ask that
and now I have not done, I was fixed on the point of registry.

I told him that if there is a javascript in a html page you can as far as I
know open every mailprogram. So why not using that. Fergus thinks it is not
possible and I leave it first to him, I think he is turning around in his
bed now with your problem, maybe he send a message in some hours.

:-)

Cor
Nov 20 '05 #25

P: n/a
Great we are on the same page then.

I hope I have not inconvienced Fergus too much.

Your web page idea what thread was that covered in?
"Cor" <no*@non.com> wrote in message
news:ON**************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

I was not suspicious, Fergus did not tell you, but in another thread Fergus said he was very busy with your problem.

I saw this thread, (I followed it more than you know) and I saw nothing in
it which described your problem, and I thought, maybe there is another way
to get an solution.

I did tell that to Fergus, and he said, you are right, normaly I ask that
and now I have not done, I was fixed on the point of registry.

I told him that if there is a javascript in a html page you can as far as I know open every mailprogram. So why not using that. Fergus thinks it is not possible and I leave it first to him, I think he is turning around in his
bed now with your problem, maybe he send a message in some hours.

:-)

Cor

Nov 20 '05 #26

P: n/a
HI all just so you know........

I figured out where outlook stored the registry information on outlook
users.......kind of...

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Messaging Subsystem\Profiles\Outlook

But interpreting the results of is problematic as you will see.

"Cor" <no*@non.com> wrote in message
news:ON**************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

I was not suspicious, Fergus did not tell you, but in another thread Fergus said he was very busy with your problem.

I saw this thread, (I followed it more than you know) and I saw nothing in
it which described your problem, and I thought, maybe there is another way
to get an solution.

I did tell that to Fergus, and he said, you are right, normaly I ask that
and now I have not done, I was fixed on the point of registry.

I told him that if there is a javascript in a html page you can as far as I know open every mailprogram. So why not using that. Fergus thinks it is not possible and I leave it first to him, I think he is turning around in his
bed now with your problem, maybe he send a message in some hours.

:-)

Cor

Nov 20 '05 #27

P: n/a
Cor
Hi Scorpion,

In that thread you was answering, there was something that I had send in
using JavaScript in a Window program, I can send it here or you can just
take it there?

What you want?

Cor
Nov 20 '05 #28

P: n/a
Okay possible scenario.

If no SMTP value is detected in the Outlook Express arena we talked about
this weekend we can check outlook under the Windows Messaging Subsystem key
using HKEY_USERS\insert numbers here but should end with-500

HKEY_USERS\number ending in -500\Software\Microsoft\Windows
NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook

1. It seems in the windows messaging subsystem there will be one subkey that
will contain the LastChange and NextAccout subkeys. It would be necessary to
loop through all folders under the Outlook subkeys to determine which one.

2. Once that is found the subkey with the highest number is selected(e.g.
000003 or whatever).

3. The value of the SMTP Server is grabbed.

4. Now we have to convert the BINARY format to something useable. Not a clue
there.........The value we would need is present but how to get rid of all
the junk along with it....

"scorpion53061" <sc************@yahoo.com> wrote in message
news:O0**************@tk2msftngp13.phx.gbl...
Great we are on the same page then.

I hope I have not inconvienced Fergus too much.

Your web page idea what thread was that covered in?
"Cor" <no*@non.com> wrote in message
news:ON**************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

I was not suspicious, Fergus did not tell you, but in another thread Fergus
said he was very busy with your problem.

I saw this thread, (I followed it more than you know) and I saw nothing in it which described your problem, and I thought, maybe there is another way to get an solution.

I did tell that to Fergus, and he said, you are right, normaly I ask that and now I have not done, I was fixed on the point of registry.

I told him that if there is a javascript in a html page you can as far as I
know open every mailprogram. So why not using that. Fergus thinks it is

not
possible and I leave it first to him, I think he is turning around in

his bed now with your problem, maybe he send a message in some hours.

:-)

Cor


Nov 20 '05 #29

P: n/a
send it to ad***@takethisoutjjkoepsell.com

The attachment never arrived in the other thread.

"Cor" <no*@non.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

In that thread you was answering, there was something that I had send in
using JavaScript in a Window program, I can send it here or you can just
take it there?

What you want?

Cor

Nov 20 '05 #30

P: n/a
Cor
Hi Scorpion,
It was not an attachment just this
For a webform
\\\
Dim str As String
str = "<script language=javascript> {window.open('http://www.google.com');}
</script>"
RegisterStartupScript("Startup", str)
///
For a windowform (author HKW) I think he did forget it :-))
\\\
AxWebBrowser.Navigate("about:<html><body
onload=javascript:window.external.addFavorite('" + textbox1.Text +
"')></body></html>")
///
I think you would use the one beneath. This was to open the favorite menu.

I am not absolute sure if it will work, but when Fergus does not find it, I
go look for it also tomorrow. I have only still few free time today, but
tonight I am again home and will look..

OK?

Cor

Nov 20 '05 #31

P: n/a
good to me.........
Thank you for your input on this......

"Cor" <no*@non.com> wrote in message
news:ee**************@TK2MSFTNGP10.phx.gbl...
Hi Scorpion,
It was not an attachment just this
For a webform
\\\
Dim str As String
str = "<script language=javascript> {window.open('http://www.google.com');} </script>"
RegisterStartupScript("Startup", str)
///
For a windowform (author HKW) I think he did forget it :-))
\\\
AxWebBrowser.Navigate("about:<html><body
onload=javascript:window.external.addFavorite('" + textbox1.Text +
"')></body></html>")
///
I think you would use the one beneath. This was to open the favorite menu.

I am not absolute sure if it will work, but when Fergus does not find it, I go look for it also tomorrow. I have only still few free time today, but
tonight I am again home and will look..

OK?

Cor


Nov 20 '05 #32

P: n/a
Cor
Hi Scorpion,
Can you try if this is something for you?

You have to set a reference to the com microsoft.webbrowser

\\\\
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.AxWebBrowser1.Navigate2("mailto:no*@non.com?sub ject=Maildemo&body=The
Scorpion and the man of Fer")
End Sub
////
Keep track that there are no spaces in Maildemo&body

Cor
Nov 20 '05 #33

P: n/a
Hi Cor,

In the message where I said I think it's not possible, I had a ROFL.

That's because I've written two long posts describing how Url Protocols
(including mailto:) work I've also posted so many snippets that send mail
using mailto: that I've lost count.

So I was being very tongue-in-cheek when I said it couldn't be done.
;-)

The routine below will put a message into the email program but not do the
actual send. This is left to the User, after they've done any editing that
they might want to do.

Regards,
Fergus

<code>
'A reference to System.Web may be necessary
'in the Project for this Import to work.
Imports System.Web.HttpUtility

Public Sub StartDefaultMail (sTo As String, _
Optional sSubject As String = "", _
Optional sMessage As String = "")
Try
sTo = UrlEncode (sTo)
sSubject = UrlEncode (sSubject)
sMessage = UrlEncode (sMessage)
Process.Start ("mailto:" & sTo & "?subject=" _
& sSubject & "&body=" & sMessage)

Catch e As Exception
MsgBox ("Couldn't start default email application" _
& vbCrLf & e.Message)
'or
Throw New Exception ("Couldn't start default email app", e)
End Try
End Sub
</code>
Nov 20 '05 #34

P: n/a
Hi Scorpion,

I'm still not clear on this. Which of the following is/are correct?

1 You need to know the Smtp Server so that you can use it with the .NET
mail classes.

2 You need to know the Smtp Server so that you can use it with
something else.

3 You want to compose <and> send a mail independantly of the User.

4 You want to create a mail message and then stick it into the default
email application so that the User can finish it off and send it

5 Something else.

Regards,
Fergus
Nov 20 '05 #35

P: n/a
Cor
Hi Fergus,

And I was very suprised you said that, so I thought let me wait, because I
knew that you did something for Nick a long while ago.

But I saw nothing so I made something this afternoon here.

Now Scorpion has an alternative so he can choose if he want that solution.

But although my solution looks shorter, I would use yours, because with what
I made you have to distribute the SHdoc to (You understand I write this also
for Scorpion).

:-)
Cor
Nov 20 '05 #36

P: n/a
Hi Scorpion,

And as a separate topic: Any trouble I'm taking with this serves me too,
so no worries there. ;-)

Do you still want the option of searching the Registry? I have a raw
searcher done but taking it beyond a snippet will require more work (again,
don't worry, I want this for myself, too).

Basically, a registry search takes a long time. If you do two searches in
a row that doubles it (naturally) but doing two searchges together is much
better because most of the time is spent opening and closing Registry Keys and
getting the name lists.

The other aspect is that the long time required means that a threaded
approach with progress reporting is preferable.

So if you still want it, can you hold on while I knit these all together?
And if so, could you give me details of the specific searches that you would
want to do. So far I've got
Search for all values named 'Smpt Server'.
Find all Keys under HKEY_USERS which ending with '-500'.

Are there any others? Do you need to search for value <data> as well as
names?

Regards,
Fergus
Nov 20 '05 #37

P: n/a
Hi Cor,

Understood, mate, my previous message was also partly for Scorpion ;-)
but this one's just for you.

I have to say, Cor:
Thank you, thank you, thank you.

Without intending to, you have solved a most hair-pulling problem for me.
For a long while now, back as far as Charles' UserControl/WebBrowser issue and
before, I've been unable to actually <use> a Web Browser Control. I could
<create> one easily enough. It would sit on my Form looking all white and
blank and ready for some Html. But there were no browsing methods!??

In your post you said distribute the 'ShDoc' and I thought - 'don't you
mean the AxBrowser?'. That's what I've had all this time and I thought it must
have got broken somehow. It seems to have no browse capability at all. But
yours is working for you and mine's not so ShDoc must mean something.

Thus inspired, I took out the AxBrowser and all references, removed it
from the ToolBox, deleted all the Interop wrappers and started again. There
under Add References all I had was AxBrowse, as before, but then appeared the
ShDocVw which I'd skipped past so many times because I was thinking of Windows
Explorer and the <List> View and didn't recognise that it's the Browser!!.
Haha!!

I'm a happy bunny again. ;-))

Regards,
Fergus
Nov 20 '05 #38

P: n/a
I am working on something similar.......

Sorry I was buried for a couple days at work and didnt get back here as much
as I would liek

I want to do the registry thing because I think it would be a powerful addin
for a lot of apps I build.

"Fergus Cooney" <fi*****@post.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

And as a separate topic: Any trouble I'm taking with this serves me too, so no worries there. ;-)

Do you still want the option of searching the Registry? I have a raw
searcher done but taking it beyond a snippet will require more work (again, don't worry, I want this for myself, too).

Basically, a registry search takes a long time. If you do two searches in a row that doubles it (naturally) but doing two searchges together is much
better because most of the time is spent opening and closing Registry Keys and getting the name lists.

The other aspect is that the long time required means that a threaded
approach with progress reporting is preferable.

So if you still want it, can you hold on while I knit these all together? And if so, could you give me details of the specific searches that you would want to do. So far I've got
Search for all values named 'Smpt Server'.
Find all Keys under HKEY_USERS which ending with '-500'.

Are there any others? Do you need to search for value <data> as well as names?

Regards,
Fergus

Nov 20 '05 #39

P: n/a
was very good.......this works but we have a custom mailer I built he was
wanting that used with.....A form with a textbox for them to type in and
attach a file.
If I could suppress the email program and grab the server name then we would
be on to something

"Cor" <no*@non.com> wrote in message
news:Od**************@TK2MSFTNGP12.phx.gbl...
Hi Scorpion,
Can you try if this is something for you?

You have to set a reference to the com microsoft.webbrowser

\\\\
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.AxWebBrowser1.Navigate2("mailto:no*@non.com?sub ject=Maildemo&body=The
Scorpion and the man of Fer")
End Sub
////
Keep track that there are no spaces in Maildemo&body

Cor

Nov 20 '05 #40

P: n/a
Basically how this started was the boss didnt want people to enter anything
for the options box, just simply be able to detect their smtp server.

Thus the problem began in detecting this....
It was much more complicated than I ever imagined...

"Fergus Cooney" <fi*****@post.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

And as a separate topic: Any trouble I'm taking with this serves me too, so no worries there. ;-)

Do you still want the option of searching the Registry? I have a raw
searcher done but taking it beyond a snippet will require more work (again, don't worry, I want this for myself, too).

Basically, a registry search takes a long time. If you do two searches in a row that doubles it (naturally) but doing two searchges together is much
better because most of the time is spent opening and closing Registry Keys and getting the name lists.

The other aspect is that the long time required means that a threaded
approach with progress reporting is preferable.

So if you still want it, can you hold on while I knit these all together? And if so, could you give me details of the specific searches that you would want to do. So far I've got
Search for all values named 'Smpt Server'.
Find all Keys under HKEY_USERS which ending with '-500'.

Are there any others? Do you need to search for value <data> as well as names?

Regards,
Fergus

Nov 20 '05 #41

P: n/a
Fergus,

Will you show me where you are at with the registry search so I can build on
it?
ad***@nospamjjkoepsell.com

remove 'nospam'

"scorpion53061" <sc************@yahoo.com> wrote in message
news:et***************@TK2MSFTNGP11.phx.gbl...
I am working on something similar.......

Sorry I was buried for a couple days at work and didnt get back here as much as I would liek

I want to do the registry thing because I think it would be a powerful addin for a lot of apps I build.

"Fergus Cooney" <fi*****@post.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
Hi Scorpion,

And as a separate topic: Any trouble I'm taking with this serves me too,
so no worries there. ;-)

Do you still want the option of searching the Registry? I have a raw
searcher done but taking it beyond a snippet will require more work

(again,
don't worry, I want this for myself, too).

Basically, a registry search takes a long time. If you do two searches in
a row that doubles it (naturally) but doing two searchges together is
much better because most of the time is spent opening and closing Registry Keys and
getting the name lists.

The other aspect is that the long time required means that a

threaded approach with progress reporting is preferable.

So if you still want it, can you hold on while I knit these all

together?
And if so, could you give me details of the specific searches that you

would
want to do. So far I've got
Search for all values named 'Smpt Server'.
Find all Keys under HKEY_USERS which ending with '-500'.

Are there any others? Do you need to search for value <data> as well

as
names?

Regards,
Fergus


Nov 20 '05 #42

P: n/a
Fergus,

This may help.........it will list all com components which will include
email.....
Now the trick is to know what to look for there....

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
txtOut.Text = ""
DisplayCOMComponents()
End Sub

Sub DisplayCOMComponents()
Dim regClsid As RegistryKey =
Registry.ClassesRoot.OpenSubKey("CLSID")

Dim clsid As String
For Each clsid In regClsid.GetSubKeyNames
Dim regClsidKey As RegistryKey =
regClsid.OpenSubKey(clsid)

Dim ProgID As String = CStr(regClsidKey.GetValue(""))
Dim regPath As RegistryKey =
regClsidKey.OpenSubKey("InprocServer32")
If regPath Is Nothing Then
regPath =
regClsidKey.OpenSubKey("LocalServer32")
End If
If Not (regPath Is Nothing) Then
Dim filePath As String =
CStr(regPath.GetValue(""))
LogMessage(ProgID & " " & clsid & " -> " &
filePath)
regPath.Close()
End If

regClsidKey.Close()
Next
End Sub
"Fergus Cooney" <fi****@post.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi Scorp,

|| How is that registry application coming?

I'm sorry, I took a bit of a break, and then visited the newsgroup salad bar and put too much on my plate, lol - so I haven't done anything on it since we last spoke. I shall resist looking at new messages!! ;-)

I wanted to wait until I had more to give you. The stuff that goes around the core needs more work. I'll be doing a couple of other investigations that people sent in to me (salad is quick to eat) and then get back to the
RegSearcher. I'll send you the core routine later 'today' plus whatever I've managed to do in the meantime.

|| Is there anything I can help with?

Yes, please. Some more details on the searches that you will be doing
would be handy. Can you give me as full a list as possible? I want to know
what searches you would do (to see how they'll work in parallel), what types you are searching for (keys, values and/or data) and also whether you'd want to do a whole-registry search or one restricted to a known set of nodes. (This last one, if required, will have to be in version three.)

Regards,
Fergus

Nov 20 '05 #43

This discussion thread is closed

Replies have been disabled for this discussion.