Fixes for undefined array key 'message' error with postmark
This commit is contained in:
parent
925c934e73
commit
cb13104569
|
|
@ -249,8 +249,19 @@ class NinjaMailerJob implements ShouldQueue
|
||||||
|
|
||||||
if ($e instanceof PostmarkException) { //postmark specific failure
|
if ($e instanceof PostmarkException) { //postmark specific failure
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = json_decode($e->getMessage(), true);
|
||||||
|
if (is_array($response) && isset($response['Message'])) {
|
||||||
|
$message = $response['Message'];
|
||||||
|
}
|
||||||
|
} catch (\Exception $jsonError) {
|
||||||
|
// If JSON decode fails, use the original message
|
||||||
|
$message = "Unknown issue sending via Postmark, please try again later.";
|
||||||
|
}
|
||||||
|
|
||||||
$this->fail();
|
$this->fail();
|
||||||
$this->entityEmailFailed($e->getMessage());
|
$this->entityEmailFailed($message);
|
||||||
$this->cleanUpMailers();
|
$this->cleanUpMailers();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -370,17 +370,26 @@ class Email implements ShouldQueue
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post mark buries the proper message in a guzzle response
|
* Post mark buries the proper message in a guzzle response
|
||||||
* this merges a text string with a json object
|
* this merges a text string with a json object
|
||||||
* need to harvest the ->Message property using the following
|
* need to harvest the ->Message property using the following
|
||||||
*/
|
*/
|
||||||
if ($e instanceof PostmarkException) { //postmark specific failure
|
if ($e instanceof PostmarkException) { //postmark specific failure
|
||||||
|
|
||||||
|
// Try to decode the JSON response if present
|
||||||
|
try {
|
||||||
|
$response = json_decode($e->getMessage(), true);
|
||||||
|
if (is_array($response) && isset($response['Message'])) {
|
||||||
|
$message = $response['Message'];
|
||||||
|
}
|
||||||
|
} catch (\Exception $jsonError) {
|
||||||
|
// If JSON decode fails, use the original message
|
||||||
|
$message = "Unknown issue sending via Postmark, please try again later.";
|
||||||
|
}
|
||||||
|
|
||||||
$this->fail();
|
$this->fail();
|
||||||
$this->entityEmailFailed($e->getMessage());
|
$this->entityEmailFailed($message);
|
||||||
$this->cleanUpMailers();
|
$this->cleanUpMailers();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -5169,16 +5169,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/framework",
|
"name": "laravel/framework",
|
||||||
"version": "v11.44.4",
|
"version": "v11.44.7",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/laravel/framework.git",
|
"url": "https://github.com/laravel/framework.git",
|
||||||
"reference": "6b29bb79b18474ea5265b7022ba7b0f76eebeb4f"
|
"reference": "00bc6ac91a6d577bf051c18ddaa638c0d221e1c7"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/laravel/framework/zipball/6b29bb79b18474ea5265b7022ba7b0f76eebeb4f",
|
"url": "https://api.github.com/repos/laravel/framework/zipball/00bc6ac91a6d577bf051c18ddaa638c0d221e1c7",
|
||||||
"reference": "6b29bb79b18474ea5265b7022ba7b0f76eebeb4f",
|
"reference": "00bc6ac91a6d577bf051c18ddaa638c0d221e1c7",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
|
@ -5380,7 +5380,7 @@
|
||||||
"issues": "https://github.com/laravel/framework/issues",
|
"issues": "https://github.com/laravel/framework/issues",
|
||||||
"source": "https://github.com/laravel/framework"
|
"source": "https://github.com/laravel/framework"
|
||||||
},
|
},
|
||||||
"time": "2025-04-23T23:35:40+00:00"
|
"time": "2025-04-25T12:40:47+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "laravel/octane",
|
"name": "laravel/octane",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue