[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Checking legal email address string

Posted on 1998-07-03
5
Medium Priority
?
299 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

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.

Question has a verified solution.

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

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…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

656 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