Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Validate domain name in an emali account

Posted on 2010-08-13
13
Medium Priority
?
382 Views
Last Modified: 2012-06-21
Hi: We want to be able to validate the domain name of an email account when user input this value in our webpage, in short terms we want to accomplish the following scenerio:
user type->: myaccount@anygivendomainname.com
our routine checks for anygivendomainname.com and check if it really exists, if not then we can inform customer and she/he can double check the field value
Thanks
0
Comment
Question by:rubensc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
13 Comments
 
LVL 5

Expert Comment

by:JayFromPep
ID: 33429715
There are a ton of answers for this.

You can do some pretty cool stuff with System.net.dns that will allow you to check with some dns servers to make sure the domain is a valid domain.

I.E.....

IPHostEntry hostInfo = Dns.GetHostByName("www.contoso.com");

You can also use 3rd party stuff.

here is a link to a topic that touches on just this.

http://www.velocityreviews.com/forums/t81340-dns-lookup-from-net-validate-email-address-domain.html
0
 
LVL 11

Expert Comment

by:ladarling
ID: 33431966
This is an example of splitting the email address apart and checking it with a host lookup:
(The split will put place the username in index 0 and the domain in index 1 of a string array)
 

Dim anEmailAddress As String = "somebody@somewhere.com"
        Dim mailParts() As String = Split(anEmailAddress, "@")
        Dim hostIP As Net.IPHostEntry = Net.Dns.GetHostEntry(mailParts(1))
        If Not IsNothing(hostIP) Then
            MsgBox("DNS found the domain name: " & hostIP.HostName)
        Else
            MsgBox("Not a valid domain:" & hostIP.HostName)

        End If

Open in new window

0
 
LVL 5

Expert Comment

by:JayFromPep
ID: 33432111
Sorry, i put it in c#.

But ladarling is right.  Just a simple split and dns check will cover you on it.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Expert Comment

by:DanielBlais
ID: 33446255
In VB6 application, I don't know how to do this.  You can use the NSLOOKUP command line tool.

Call this line and get back the result in .txt file.
nslookup.exe -type=MX somewhere.com > nslookup.txt

Open in new window

0
 

Author Comment

by:rubensc
ID: 33446873
DanielBlais: Thanks for the comment, but I don't plan to use a Shell to execute the command.
0
 
LVL 2

Accepted Solution

by:
DanielBlais earned 500 total points
ID: 33447000
0
 
LVL 11

Expert Comment

by:ladarling
ID: 33447048
Did my previous code not work for you?
0
 
LVL 2

Expert Comment

by:DanielBlais
ID: 33447131
I just noticed your question is on both classic VB and VB.NET.

Can you tell us which language you want.
0
 

Author Comment

by:rubensc
ID: 33457348
I can do both, no problem
Thanks
0
 
LVL 2

Expert Comment

by:DanielBlais
ID: 33457887
So, is there any good solution for you?
0
 

Author Comment

by:rubensc
ID: 33457939
I will prefer ASP.NET, the thing with the cmdshell (nslookup) it's external and asyncronous, we are testing the Net.Dns.GetHostEntry stuff, any other idea?
Regards
0
 
LVL 2

Expert Comment

by:DanielBlais
ID: 33457977
I agree the .NET solution is the best one.
0
 

Author Closing Comment

by:rubensc
ID: 33719159
I resolve it
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question