Solved

Checking legal email address string

Posted on 1998-07-03
5
289 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
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 100 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

746 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now