Solved

Validate email address on MFC dialog

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

22 Experts available now in Live!

Get 1:1 Help Now