?
Solved

Validate email address on MFC dialog

Posted on 2004-04-09
4
Medium Priority
?
1,042 Views
Last Modified: 2013-11-20
I am storing email address in my database & mails will be sent to them automatically.
User can specify email address in text box of MFC dialog. I would like to know is there any validation i can do for the same like javascript validation.
0
Comment
Question by:amlooks
[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
4 Comments
 
LVL 11

Accepted Solution

by:
KurtVon earned 100 total points
ID: 10791215
The only way to validate an email address is to email to it and wait for a reply.  Spammers would probably love some sort of automated validation, but it doesn't exist or they would be using it for harvesting purposes.

You can, however make sure the email address is in a valid format.  It should contain only one @, have text before and after that, and the text after should be a valid domain name.  Valid domain names have at least one ".", and conatian only alphanumerics and the "-" character.

Hope this helps.
0
 
LVL 14

Expert Comment

by:wayside
ID: 10792081
You can do a lookup on the domain name to make sure it is a valid domain (use gethostbyname() for example).

Ths can be a lengthy operation depending on how good your access to the names server is.
0
 
LVL 4

Expert Comment

by:bkfirebird
ID: 10794580
I faced a similar problem before and tried looking up host name,etc but it turned out to be too wasteful. Instead I just checked for the following pattern xxxxx@xxxx.tld where tld was a from a list of common top level domains that i statically declared.

-Kiran Adigopula
0
 
LVL 5

Expert Comment

by:Nass89
ID: 10795709
Hi,
If you want to check the format of Emai l address use:

char Address_String[], Name[], Domain[], Ext[];
sscanf(Address_String, "%s@%s.%s", Name, Domain, Ext);

and check each field to validate it.

If you want to find, if it is a valid Email, KurtVon has stated it.

Good Luck!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

777 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