Solved

Checking legal email address string

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Fully specialized class template function 21 130
Dynamically allocate memory 9 56
How to convert MFC::CString to UTF8 wchar_t* 10 147
Beginner to Unreal Engine 4 5 61
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

920 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

13 Experts available now in Live!

Get 1:1 Help Now