A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Other JSE/JEE APIs
Joined: Apr 11, 2012
Apr 11, 2012 10:54:51
Can anyone guide me in writing the code for email validation.
i.e when you register for a site,it should send an email verification to that particular email -id .
William P O'Sullivan
Joined: Mar 28, 2012
Apr 11, 2012 11:01:55
Not a trivial task.
Accept email address from user.
Assign a unique id (GUID) to that email and store both fields in a database.
Build and Send the validation email (use sendmail api) and in the body put the url to click.
(This would pass the unique id as a parameter to a validation
Here's the fun part, once they click on the URL, you would need to know the email address of the clicker!
You can ask them to verify and the servlet then matches the passed GUID to the db entry.
Much work needed... but map out the flow first, using simply sequence diagrams or use cases.
Joined: Sep 21, 2011
Apr 11, 2012 16:16:14
What William said
An additional concern: The URL should only be valid for a limited time - maybe a few hours, but no more than a day. So the GUID would need to have a timestamp associated with it that indicates its expiration.
I agree. Here's the link:
subject: Email validation
Validator - is this valid "email"
Regular Expression for EMail Validation
Struts Validate problem in email
How to validate email id with special characters + Validation FrameWork
Please share any Java code to do email validation
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014