laravel-postmark-provider icon indicating copy to clipboard operation
laravel-postmark-provider copied to clipboard

Catching PostMark Exceptions

Open maximusblade opened this issue 8 years ago • 2 comments

Where is the best way to catch these kinds of errors?

GuzzleHttp\Exception\ClientException: Client error: `POST https://api.postmarkapp.com/email` resulted in a `422 Unprocessable Entity` response:
{"ErrorCode":406,"Message":"You tried to send to a recipient that has been marked as inactive.\nFound inactive addresses (truncated...)

maximusblade avatar Aug 16 '16 09:08 maximusblade

@maximusblade Unfortunately, because we funnel through Laravel's mail processing system, sending messages is basically "fire and forget", there's no way for our mail provider to back-channel this error through the normal Laravel code.

Since Laravel has SMTP support built in, we are currently recommending sending with Postmark via the built in SMTP support, instead of using this plugin.

That said, we ran into a similar issue with the way that wp_mail works in our Wordpress plugin.

Since wp_mail doesn't return error codes, we added a static property in our Postmark class that has the "last error" assigned. This is not ideal, but can provide a mechanism for seeing if a send failed. Would a similar mechanism added to the Laravel Postmark provider be helpful to you?

atheken avatar Aug 24 '16 15:08 atheken

Hello!

What the best way to send email with template in Laravel 5.3 with Postmark API (sendEmailWithTemplate function)?

wildbit/laravel-postmark-provider doesn't work with Laravel 5.3 and by SMTP is not possible work with Postmark templates.

jefferson333 avatar Oct 10 '16 16:10 jefferson333