Solved

Checking legal email address string

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
TCP/IP Socket - connection close results in data lost 14 136
C++ finding a sting in a char* string from a text file 3 110
max float value 3 42
VS2015 Redefinition errors 4 52
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

831 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