0

I'm using createuser wizard for creating new users. I'm not using any membership provider. While creating a new user, the user has to enter the email address in the createuser wizard. How to know that the entered email address is correct? If a user enters the email as abcd@abcd.com, how to know that it is a valid email address?

The email regular expression given in MSDN website does not work for me. It is <asp:createuserwizard id="Createuserwizard1" runat="server" emailregularexpression='@"^([\w-\.]+)@(([[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$"' emailregularexpressionerrormessage="E-mail address must be in a valid format"> </asp:createuserwizard>

user662417
  • 149
  • 3
  • 9
  • This question is asked all the time. Try a search and you should be able to find one! – DanTheMan Nov 16 '11 at 21:12
  • Valid email as in correctly formed or as in actually exists? – George Johnston Nov 16 '11 at 21:13
  • Because it's a really common question that you could've found the answer by googling it. I won't downvote it, but you should be more careful and put a little more effort next time. – Carlo Nov 16 '11 at 21:14
  • Do you want to validate it is a correct syntax for an e-mail, or if it is a valid e-mail account that the user must confirm by sending them an actual e-mail with a validation code? – Jon Adams Nov 16 '11 at 21:19
  • If you need a e-mail syntax regular expression, see http://stackoverflow.com/q/201323/2291 – Jon Adams Nov 16 '11 at 21:20

3 Answers3

3

Send a message to the email address to which the user has to respond.

Emond
  • 50,210
  • 11
  • 84
  • 115
2

The best way is at first to check with a regex (to ensure it contains a @ and a domain) and then to send a confirmation mail to that address. Only when the new user clicks on a link in that confirmation e-mail, his account is established and you can be asured that the e-mail address is correct.

Fischermaen
  • 12,238
  • 2
  • 39
  • 56
0
<asp:createuserwizard id="Createuserwizard1" runat="server" emailregularexpression="^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$" emailregularexpressionerrormessage="E-mail address must be in a valid format"> </asp:createuserwizard>

This expression for email in createuser wizard helped me.

user662417
  • 149
  • 3
  • 9