question

Chethan V avatar image
Chethan V asked

Why am I not getting the verification email on SignUp and the Verification status "Unverified" while sigup

Hi I am trying to implement email verification on signup. I am following this guide for that

But the problem is I am not getting the verification email while I signup. Also I saw that the contact email is getting added but the verification status is "Unverified".Also no events are triggered in the Playstream.

What I am doing is as soon as I signup the player , I am adding the contact email of the player as well. But I don't understand why is it that I am not getting the confirm email link as such.

Here is the code:

public void SignUpButton()
    {
        var request = new RegisterPlayFabUserRequest
        {
            Username = UserNameInput.text,
            Email = emailInput.text,
            Password = passwordInput.text,
        };
        PlayFabClientAPI.RegisterPlayFabUser(request, OnSignUpSuccess, OnError);
      } 

So when the signup button is pressed the above function gets executed. In the OnSignUpSuccess function:

 private void OnSignUpSuccess(RegisterPlayFabUserResult result)
    {
        StartCoroutine(WaiterOnSignUpSuccess());
    }

Now as per the documentation I have written the following code:

void AddContactEmailToPlayer(string userName, string emailId)
    {
        var loginReq = new LoginWithCustomIDRequest
        {
            CustomId = userName, // replace with your own Custom ID
            CreateAccount = true // otherwise this will create an account with that ID
        };
        var emailAddress = emailId; // Set this to your own email
        PlayFabClientAPI.LoginWithCustomID(loginReq, loginRes =>
        {
            Debug.Log("Successfully logged in player with PlayFabId: " + loginRes.PlayFabId);
            AddOrUpdateContactEmail(emailAddress);
        }, FailureCallback);
    }
    void AddOrUpdateContactEmail(string emailAddress)
    {
        var request = new AddOrUpdateContactEmailRequest
        {
            EmailAddress = emailAddress
        };
        PlayFabClientAPI.AddOrUpdateContactEmail(request, result =>
        {
            Debug.Log("The player's account has been updated with a contact email");
        }, FailureCallback);
    }
    void FailureCallback(PlayFabError error)
    {
        Debug.LogWarning("Something went wrong with your API call. Here's some debug information:");
        Debug.LogError(error.GenerateErrorReport());
        MessageFormatter(error.ErrorMessage);
    }
} 

I dont know whether I did something wrong with the email and custom-ID link. I changed the custom ID link which you get at the end of step 1 but no use. Also it was mentioned that what ever ID you obtain there will be used in step 4, but I see it not being used anywhere.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Chethan V avatar image Chethan V commented ·

Well there seems no option to edit so, in the OnSignUpSuccess function a line was missing.The updated code is :

 private void OnSignUpSuccess(RegisterPlayFabUserResult result)
    {
        AddContactEmailToPlayer(UserNameInput.text, emailInput.text);
        StartCoroutine(WaiterOnSignUpSuccess());
    }

Also, for each user 2 entries are being made.Can that be made only one?
0 Likes 0 ·
Chethan V avatar image Chethan V commented ·

Hi is there anybody to answer this? @Brendan I see you are an active member, if you may please help

0 Likes 0 ·

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

You are already logged in to PlayFab after calling RegisterPlayFabUser, there is no need to call the API LoginWithCustomID again, that's why two users are created. Besides, if you want to re-login the user that you create with RegisterPlayFabUser, you should use API LoginWithEmailAddress.

As for the verification email issue, as the document mentions, "To send custom emails with email templates, you will need to have your own SMTP server with a username and password. Please verify that you have your own SMTP server before following our tutorial Setting up an SMTP server with add-ons." Please make sure that you have set up the SMTP properly.

You mentioned that no events are generated, if you are checking the events via the Playstream page under the Players tab, please note that this is a real time event viewer, it will not show the historical events. If you want to check the event history, please navigate to [Game Manager]->[Data]->[Data Explorer]. New events may take a few mins to show up here.

If you cannot find any sent_email events in the Data Explorer, there should be something incorrect with the Rule which is used to send the verification email or the SMTP configuration. In that case, could you please share us the details about the Rule and SMTP configuration?

6 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Chethan V avatar image Chethan V commented ·

Thank you so much for answering..

Yeah I think login with custom ID was wrong. I didnt pay much attention to that. But if you have to update contact email after signup u can simply call the AddOrUpdateContactEmail() function right?

Yeah I have set up the SMTP server . I can find the sent email events here in the DataExpolrer as you mentioned. OK I am attaching the screenshots of my rule here

0 Likes 0 ·
sent-email.png (105.3 KiB)
Chethan V avatar image Chethan V Chethan V commented ·

(fine I am continuing the above answer here as I can't edit it) After after clicking the sent email mail this is what I get . Also the rule looks something like this .

The SMTP configuration is as per the documentation: i.e.,

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao Chethan V commented ·

Since the event is triggered, the issue should be related to Gmail. Have you turned on SMTP in Gmail?

0 Likes 0 ·
Show more comments
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.