The _requestFactory function splits the results from client calls into 2 arrays, accepted and rejected.
Although this is useful, it causes a problem when sending batch emails and trying to reconcile failed messages against the input payload. When a message fails, Postmark sends back the following JSON:
{
"ErrorCode": 405,
"Message": "details"
}
This does not contain any identifier to indicate the original message that failed. This is fine in single emails but a problem in batch emails where you may have both successes and failures.
Postmark docs say that the results will be ordered the same as the original messages and leaves it to the user to compare the input against the results to match up the responses with the original messages.
Unfortunately this order is lost in the following code of the _requestFactory:
Hi,
The
_requestFactory
function splits the results from client calls into 2 arrays,accepted
andrejected
.Although this is useful, it causes a problem when sending batch emails and trying to reconcile failed messages against the input payload. When a message fails, Postmark sends back the following JSON:
This does not contain any identifier to indicate the original message that failed. This is fine in single emails but a problem in batch emails where you may have both successes and failures.
Postmark docs say that the results will be ordered the same as the original messages and leaves it to the user to compare the input against the results to match up the responses with the original messages.
Unfortunately this order is lost in the following code of the
_requestFactory
:A simple fix would be to update the
_requestFactory
to return an extra field that contains the original results, e.g.:Consumers can then access that array if they wish to match the input to the output. I need this code so will raise a PR.