question

Hiroaki Komatsu avatar image
Hiroaki Komatsu asked

Contact Email Address is not working sometimes (bug?)

I've been having trouble implementing Contact Email verification.
The problem is that sometimes it works, sometimes it fails silently.
I did as instructed by the tutorial here
https://api.playfab.com/docs/tutorials/landing-automation/using-a-rule-to-verify-a-contact-email-address

And sometimes at registration stage, PlayStream shows the email is sent.

Sometimes, the registration is a success, but the Contact Email Address is empty.
Worse is that the AddorUpdateContactEmailRequest fails if the email is empty, so... it doesn't send any email.
So, instead of that function, I used SendEmailFromTemplateRequest instead, which sends out the confirmation email fine, but because the ContactEmail is empty in some cases, this also fails when you click the confirmation URL... it's not the same function as AddorUpdate.

It's funny because all the requests are passed as success, but the result is not a email sent. nothing happens on the PlayStream...

Can somebody please point out the possible problem?

I'm building on Unity for WebGL.

some of the code here

SendEmailFromTemplateRequest emailReq = new SendEmailFromTemplateRequest {

PlayFabId = playerProfile.PlayerId,
EmailTemplateId = verificationTemplateId
};

PlayFabServerAPI.SendEmailFromTemplate(emailReq, ResendEmailSuccess, ResendEmailError);

and

AddOrUpdateContactEmailRequest emailRequest = new AddOrUpdateContactEmailRequest() {

EmailAddress = contactEmail

};

PlayFabClientAPI.AddOrUpdateContactEmail(emailRequest, OnEmailAccountLinkSuccess, OnEmailAccountLinkError);

SendEmailFromTemplate works and send email, only with a broken confirmation link.

AddOrUpdateContactEmail returns success, however, the playstream logs no "sent email" action performed and the email is not sent at all. this is a silent error that should be fixed at least...

Player Data
10 |1200

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

Citrus Yan avatar image
Citrus Yan answered

Hi @Hiroaki Komatsu,

I am answering your question assuming that you walked through the whole tutorial you mentioned above.

You were saying “And sometimes at registration stage, PlayStream shows the email is sent.”, so do you mean that sometimes there is no “email_sent” event generated after you successfully called the AddorUpdateContactEmail API (the contactEmail passed to the EmailAddress parameter it is not empty, and the response returns “OK”), the “player_updated_contact_email” event was also generated too. If that’s the case, it’s possible that there is something wrong with the Rule system ( the “player_updated_contact_email” event somehow didn’t trigger the “Send email” Action), could you please provide us your title id and the PlayFabIds of those associated players for us to investigate?

You were saying “Sometimes, the registration is a success, but the Contact Email Address is empty.”, do you mean that the Contact Email field is empty after you successfully called the AddorUpdateContactEmail API (the contactEmail passed to the EmailAddress parameter it is not empty, and the response returns “OK”), like this:

If that’s the case, there are several possible reasons for this:

  1. The AddorUpdateContactEmail API request failed, you may need to check the error messages for more info.
  2. There is a time lag before the contact email gets actually updated in the PlayFab backend, you may need to wait a while before accessing it.

You were saying “Worse is that the AddorUpdateContactEmailRequest fails if the email is empty, so... it doesn't send any email.”, as I see it, it’s quite reasonable: EmailAddress is a required property in the AddOrUpdateContactEmailRequest, hence error will occur if it’s empty. And it's possible that the “player_updated_contact_email” event won’t get generated given the fact that the AddorUpdateContactEmail Request failed, so the “Send email” action won’t be triggered.

You were saying “So, instead of that function, …, nothing happens on the PlayStream...”, from my understanding, you can confirm that the contact email was added to the player’s profile using GetPlayerProfile with ShowContactEmailAddresses in the PlayerProfileViewConstraints set as True before calling SendEmailFromTemplat to handle the empty contact email issue. What does “this also fails when you click the confirmation URL... it's not the same function as AddorUpdate” mean? What will happen if you click the confirmation URL, could you please be more specific? Moreover, you can go to [Game Manager] -> [Data] -> [Event History] to see the latest playstream events, please note that it usually takes a while (few minutes) before accessing generated events.

You were talking about the broken confirmation link, what does it behave? Could you be more specific?

About the issue: AddOrUpdateContactEmail returns success, however, the playstream logs no "sent email" action performed and the email is not sent at all, could you provide some info to prove this issue? And it would be helpful if you can provide your title id and the PlayFabIds of those associated players for us to investigate, thanks.


contactemail.png (7.4 KiB)
7 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.

Hiroaki Komatsu avatar image Hiroaki Komatsu commented ·

https://pastebin.com/DvKTcsTE
I tried to write a reply but it doesn't go out of moderation somehow, so I copied and pasted here.

Please check.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Hiroaki Komatsu commented ·

Hi @Hiroaki Komatsu,

Please let me summarize this:

You called AddorUpdateContactEmail API with a valid email address, it returns a success message, so everything looks fine. However, the Contact email field of the player's profile in the Game Manager is empty, and the result from the GetPlayerProfile API is also empty (just to make sure that it's not a game manager UI issue). If that's the case, I think this is something we need to investigate, probably all the latter issues regarding derive from this. Could you provide some proof of this issue, so I can report this to the engineering to investigate? Thanks.

About the "token error", can you specify which "email_sent" event (event id) has the broken link? You can find the link in the "Body" field of the "email_sent" event:

{
  ...
  "Token": "842022247D7B62A2",
  ...
  "Subject": "Email Verification",
  "Body": "<head></head>\r\n<body><p> You recently registered a new email with us.</p>\r\n<p>Please click <a href=\"https://e0572.playfabapi.com/EmailConfirmation/Confirm/?token=842022247D7B62A2&titleId=E0572&templateId=666E10FB35320989\">here</a> confirm your email. Thanks!</p>"
}

0 Likes 0 ·
Hiroaki Komatsu avatar image Hiroaki Komatsu Citrus Yan commented ·

Yeah, I am using $ConfirmationURL$ or something like that variable for the template, and sent email, but the ContacttEmail is empty so verification fails.
When I used the Resend email request we used it with login email as a fall back.

Anyway, the Contact Email sometimes works, sometimes stays empty and the email_sent action is not triggered from AddOrUpdateContactEmail request because it fails to update even if it returns request success.

Please investigate. In the meantime, we decided not to use Contact Email part to verify emails. We await the fix for this. Thanks.

0 Likes 0 ·
Show more comments
Hiroaki Komatsu avatar image Hiroaki Komatsu commented ·

Hi. Sorry for the delay. Resendemail call is made with username to make sure the email is sent.

At this moment, we are putting email verification on hold so I cannot reproduce the problem. I will keep checking this post and when we come back to verification, I will try and provide. Sorry I cannot do that right now.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Hiroaki Komatsu commented ·

OK, we still need the fiddler trace to proceed with the investigation, hence we will postpone the investigation and wait for your response:)

0 Likes 0 ·
Hiroaki Komatsu avatar image
Hiroaki Komatsu answered

Same problem here too,

Have now implemented a retry system with exponential backoff.

While the call does fail a lot. Even after a retry, sometimes a success message is received while neither is the contact email updated nor is an email sent. Also no data events in the event history tab.

screenshot-2019-11-20-at-11218-pm.pngscreenshot-2019-11-20-at-12945-pm.png

The game is in development, but we have been showing out an early beta to users (a pool of 10) who are reporting very poor performance in terms of registration and logging in.


3 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.

Citrus Yan avatar image Citrus Yan commented ·

Can you share your title id?

0 Likes 0 ·
Hiroaki Komatsu avatar image Hiroaki Komatsu Citrus Yan commented ·

Sorry the post got posted before I could complete, here you go.

Title Id is

5CAF1

PlayFabIds of one of the account affected

9CE42CF5A0BE0606 (Master player account)

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Hiroaki Komatsu commented ·

I cannot see any of the "email_sent" or "player_updated_contact_email" events in the player's (9CE42CF5A0BE0606) event history. Could you please try executing the AddOrUpdateContactEmail API on this player through Postman (it's very useful when testing PlayFab) and see what happens?

0 Likes 0 ·
Hiroaki Komatsu avatar image
Hiroaki Komatsu answered

"You were saying “And sometimes at registration stage, PlayStream shows the email is sent.”, so do you mean that sometimes there is no “email_sent” event generated after you successfully called the AddorUpdateContactEmail API (the contactEmail passed to the EmailAddress parameter it is not empty, and the response returns “OK”), the “player_updated_contact_email” event was also generated too. If that’s the case, it’s possible that there is something wrong with the Rule system ( the “player_updated_contact_email” event somehow didn’t trigger the “Send email” Action), could you please provide us your title id and the PlayFabIds of those associated players for us to investigate?"

I mean that "email_sent" event is not generated in the PlayStream or the history of events, the EmailAddress parameter is not empty as I check from debug console and put debug line in every step of the process to make sure this is not our code's problem.

Rule system is set as instructed in the tutorial. I will attach the rule screen. (my guess is it is triggering anti-spam measures on the PlayFab side and its not sending the email.)
https://i.gyazo.com/8e4ce82ba858957add0ccd920b9da6ef.png

"You were saying “Sometimes, the registration is a success, but the Contact Email Address is empty.”, do you mean that the Contact Email field is empty after you successfully called the AddorUpdateContactEmail API (the contactEmail passed to the EmailAddress parameter it is not empty, and the response returns “OK”), like this:"

If that’s the case, there are several possible reasons for this:

  1. The AddorUpdateContactEmail API request failed, you may need to check the error messages for more info.
  2. There is a time lag before the contact email gets actually updated in the PlayFab backend, you may need to wait a while before accessing it.

Yes, Contact Email field is empty before and after the AddorUpdateContactEmail API.
request.EmailAddress is not empty, I am passing correct email address, and checked that SendEmailTemplate from API works at sending email to the set address, but AddorUpdateContactEmail API fails.... silently.
The API returns success but it has failed to update the field.

"You were saying “Worse is that the AddorUpdateContactEmailRequest fails if the email is empty, so... it doesn't send any email.”, as I see it, it’s quite reasonable: EmailAddress is a required property in the AddOrUpdateContactEmailRequest, hence error will occur if it’s empty. And it's possible that the “player_updated_contact_email” event won’t get generated given the fact that the AddorUpdateContactEmail Request failed, so the “Send email” action won’t be triggered."

It is never empty because we don't send the request if it is empty. If the ContactEmail field of the profile is empty, we set a user login email to the EmailAddress and make the request. And request always returns success message, no error.

"You were saying “So, instead of that function, …, nothing happens on the PlayStream...”, from my understanding, you can confirm that the contact email was added to the player’s profile using GetPlayerProfile with ShowContactEmailAddresses in the PlayerProfileViewConstraints set as True before calling SendEmailFromTemplat to handle the empty contact email issue.
(Yes we set it eactly as it is)

What does “this also fails when you click the confirmation URL... it's not the same function as AddorUpdate” mean? What will happen if you click the confirmation URL, could you please be more specific? Moreover, you can go to [Game Manager] -> [Data] -> [Event History] to see the latest playstream events, please note that it usually takes a while (few minutes) before accessing generated events.

You were talking about the broken confirmation link, what does it behave? Could you be more specific?"

The SendEmailFromTemplate API call sends template email with some confirmation token, which if you click, it says "tocken error" and nothing happens.

"About the issue: AddOrUpdateContactEmail returns success, however, the playstream logs no "sent email" action performed and the email is not sent at all, could you provide some info to prove this issue? And it would be helpful if you can provide your title id and the PlayFabIds of those associated players for us to investigate, thanks."

Title ID is written on the reply comments below.

Thanks.
I believe this is a problem on the API, at least it should return error if it failed to update the field.

10 |1200

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

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.