?
Solved

Checking legal email address string

Posted on 1998-07-03
5
Medium Priority
?
296 Views
Last Modified: 2012-05-04
In my C++ program I need to check whether or not a string is a legal email address.
Does anyone know if there is a library function somewhere for doing this, and if
not, what are the rules for this function.
0
Comment
Question by:kaplan1
[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 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1167140
0
 

Expert Comment

by:kashif063098
ID: 1167141
hi!
I think you need to check for few things in the string

1- '@' sign
2- '.' after @ sign
3- look for .net,.gov,.com,.org

i think you already know this

0
 

Expert Comment

by:dst
ID: 1167142
Here are some rules:

1. There must be no blank spaces.
2. There must be one (and only one) '@'-sign.
3. Only letters, numbers and following characters allowed:
   hyphen (-), dot (.) and underscore (_).
4. The part after the '@'-sign must contain at least one dot (.).

   I hope you will find it usefull.
0
 
LVL 1

Accepted Solution

by:
saneesh100 earned 200 total points
ID: 1167143
Hello..

 You can do a lot of things.
First check for @ sysmbol and there should be only one but one is needed..

 ALso the second part contailns the name of the server for eg
xxx@hotmail.com menas he is a member of hotmail server.U can quesry to the nearest DNS server to find it's MX exchange servers name for eg mail.hotmail..com in the case of hotmail .THen u can connect to that server on port 25 and query if the user ( the part before @) is valid..

 It is the safest and reliablle method and will work correctly..

0
 
LVL 84

Expert Comment

by:ozo
ID: 1167144
The proposed rules are incorrect.
More than one @ can appear in a valid email address,
as can blank spaces, or any other character when properly quoted.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

765 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