Solved

Validate email address on MFC dialog

Posted on 2004-04-09
4
963 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
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

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
Turn a spreadsheet into a vba executable. 2 78
ASCII Non-Printable characters/codes and their HTML equivalents 6 105
while loop over for loop 7 92
isEverywhere  challenge 19 72
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…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

26 Experts available now in Live!

Get 1:1 Help Now