mailjet-apiv3-dotnet icon indicating copy to clipboard operation
mailjet-apiv3-dotnet copied to clipboard

SendTransactionalEmailAsync returns TransactionalEmailResponse where Messages = null

Open mewid opened this issue 4 years ago • 0 comments

When using SendTransactionalEmailAsync, the .net sdk sometimes returns a TransactionalEmailResponse where the Messages array are null.

By looking at the code it seems like the issue is:

SendTransactionalEmailAsync demands that the MailjetResponse.Content conforms to the structure of TransactionalEmailResponse: TransactionalEmailResponse result = clientResponse.Content.ToObject<TransactionalEmailResponse>();

However this does not always seem to be the case; MailjetClients PostAsync-method uses a method GetContent to decide this structure before executing the code I mentioned above, and some errors will generate a json structure that is not an array of messages. This means that when we are using SendTransactionalEmailAsync , some errors will return a TransactionalEmailResponse where Messages are just set to null. It fails on our side, and all information of the actual error has been lost so its hard know really what happened.

mewid avatar Oct 26 '21 12:10 mewid