Solved

Validate email address on MFC dialog

Posted on 2004-04-09
4
1,028 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 50 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 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