I am using this C# code to validate a new player email before passing it to PlayFabClientAPI.RegisterPlayFabUser(RegisterPlayFabRequest, OnRegisterSuccess, ErrorOccured);:
try { var m = new MailAddress(_email); BaaS.Email = _email; } catch (Exception e) { // Complain about email. }
I found that an email of the form "Name@domain" (not .anything) passes the .NET test. But it fails when submitted to PlayFab. I found this article: https://stackoverflow.com/questions/1365407/c-sharp-code-to-validate-email-address where the most upvoted answer has this note:
Note that e-mail addresses are more forgiving than you might first assume. These are all perfectly valid forms:
- cog@wheel
- "cogwheel the orange"@example.com
- 123@$.xyz
This means that .NET will accept emails that PlayFab will not. This leads me to wonder two things:
- Should I not check and just parse the return from PlayFab to report the error? This seems like a service call that could be avoided by a local validation.
- If I am going to validate locally what code does PlayFab use to establish if something is a valid email?