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

How do I do a dns lookup ?

P: n/a
I need to obtain the ip from an email address, any ideas?
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"peak" <asdf> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I need to obtain the ip from an email address, any ideas?


strip out the domain name from the email address:
(untested - watch for typos, syntax, etc - directly typing in here..)

' this should give you mydomain.com
Dim strEmail As String = "my*******@mydomain.com"
Dim strDomain As String = _
strEmail.SubString(strEmail.IndexOf("@"c)+1, _
strEmail.Length - strEmail.IndexOf("@"c))

Then use the methods in System.Net.Dns class to retrieve the IP address:

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
MessageBox.Show(ip.ToString)
Next ip

Note that a domain could have multiple IP addresses associated with it which
is why we need the loop.

hope that helps..
Imran.
Nov 21 '05 #2

P: n/a
Hi,
This seems to return the www server instead of the smtp server,
here is what I typed

Dim ip As System.Net.IPAddress
Dim strDomain = "tiscali.co.uk"
For Each ip In System.Net.Dns.GetHostByName(strDomain).AddressLis t
MsgBox(ip.ToString)
Next ip
End

I am expecting to get the ip of
smtp.tiscali.co.uk
and instead I am getting the ip of
www.tiscali.co.uk

Any ideas?

"Imran Koradia" <no****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

"peak" <asdf> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I need to obtain the ip from an email address, any ideas?
strip out the domain name from the email address:
(untested - watch for typos, syntax, etc - directly typing in here..)

' this should give you mydomain.com
Dim strEmail As String = "my*******@mydomain.com"
Dim strDomain As String = _
strEmail.SubString(strEmail.IndexOf("@"c)+1, _
strEmail.Length - strEmail.IndexOf("@"c))

Then use the methods in System.Net.Dns class to retrieve the IP address:

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
MessageBox.Show(ip.ToString)
Next ip

Note that a domain could have multiple IP addresses associated with it

which is why we need the loop.

hope that helps..
Imran.


Nov 21 '05 #3

P: n/a
Peak
It is likely that tiscali.co.uk and www.tiscali.co.uk are aliases for
the same IP address. If you want the IP address for smtp.tiscali.co.uk, I
would suggest that that be what you submit as the strDomain.

Good Luck.
Ron L

"peak" <asdf> wrote in message news:ep**************@TK2MSFTNGP15.phx.gbl...
Hi,
This seems to return the www server instead of the smtp server,
here is what I typed

Dim ip As System.Net.IPAddress
Dim strDomain = "tiscali.co.uk"
For Each ip In System.Net.Dns.GetHostByName(strDomain).AddressLis t
MsgBox(ip.ToString)
Next ip
End

I am expecting to get the ip of
smtp.tiscali.co.uk
and instead I am getting the ip of
www.tiscali.co.uk

Any ideas?

"Imran Koradia" <no****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

"peak" <asdf> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> I need to obtain the ip from an email address, any ideas?


strip out the domain name from the email address:
(untested - watch for typos, syntax, etc - directly typing in here..)

' this should give you mydomain.com
Dim strEmail As String = "my*******@mydomain.com"
Dim strDomain As String = _
strEmail.SubString(strEmail.IndexOf("@"c)+1, _
strEmail.Length - strEmail.IndexOf("@"c))

Then use the methods in System.Net.Dns class to retrieve the IP address:

For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
MessageBox.Show(ip.ToString)
Next ip

Note that a domain could have multiple IP addresses associated with it

which
is why we need the loop.

hope that helps..
Imran.

Nov 21 '05 #4

P: n/a
This is not what I am looking for. Every smtp server knows
how to obtain the smtp address for *any* email address.
This is known I understand as dns email lookup or dns
mx record lookup. This is what I need.
I have done some research since I initially posted this
question, and it seems that someone wrote how to do this
in C#. Here is the link, maybe someone can show how
this would look like in VB:
http://www.csharphelp.com/archives/a...?printable=yes
Tia

"Ron L" <ro**@bogus.Address.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Peak
It is likely that tiscali.co.uk and www.tiscali.co.uk are aliases for
the same IP address. If you want the IP address for smtp.tiscali.co.uk, I
would suggest that that be what you submit as the strDomain.

Good Luck.
Ron L

"peak" <asdf> wrote in message

news:ep**************@TK2MSFTNGP15.phx.gbl...
Hi,
This seems to return the www server instead of the smtp server,
here is what I typed

Dim ip As System.Net.IPAddress
Dim strDomain = "tiscali.co.uk"
For Each ip In System.Net.Dns.GetHostByName(strDomain).AddressLis t
MsgBox(ip.ToString)
Next ip
End

I am expecting to get the ip of
smtp.tiscali.co.uk
and instead I am getting the ip of
www.tiscali.co.uk

Any ideas?

"Imran Koradia" <no****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

"peak" <asdf> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> I need to obtain the ip from an email address, any ideas?

strip out the domain name from the email address:
(untested - watch for typos, syntax, etc - directly typing in here..)

' this should give you mydomain.com
Dim strEmail As String = "my*******@mydomain.com"
Dim strDomain As String = _
strEmail.SubString(strEmail.IndexOf("@"c)+1, _
strEmail.Length - strEmail.IndexOf("@"c))

Then use the methods in System.Net.Dns class to retrieve the IP address:
For Each ip As System.Net.IPAddress _
In System.Net.Dns.GetHostByName(strDomain).AddressLis t
MessageBox.Show(ip.ToString)
Next ip

Note that a domain could have multiple IP addresses associated with it

which
is why we need the loop.

hope that helps..
Imran.



Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.