Ich ha
This commit is contained in:
@@ -77,6 +77,19 @@ final class Mailer
|
||||
]);
|
||||
$resp = @file_get_contents($apiBase, false, $ctx);
|
||||
if ($resp !== false) {
|
||||
$status = null;
|
||||
if (isset($http_response_header) && is_array($http_response_header)) {
|
||||
foreach ($http_response_header as $hdr) {
|
||||
if (preg_match('~^HTTP/\\S+\\s+(\\d+)~i', $hdr, $m)) {
|
||||
$status = (int)$m[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->log('template_api_response_raw', [
|
||||
'status' => $status,
|
||||
'body' => $resp,
|
||||
]);
|
||||
$decoded = json_decode($resp, true);
|
||||
if (is_array($decoded) && !empty($decoded['ok']) && !empty($decoded['html'])) {
|
||||
$this->log('template_api_success', ['template' => $id, 'subject' => $decoded['subject'] ?? null, 'html_len' => strlen((string)$decoded['html'])]);
|
||||
|
||||
Reference in New Issue
Block a user