fix: fail closed on Emailable HTTP errors, fail open on network errors only
All checks were successful
Deploy Production / Deploy to Production (push) Successful in 22s
All checks were successful
Deploy Production / Deploy to Production (push) Successful in 22s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9c2e1ee4fa
commit
4705433238
1 changed files with 8 additions and 3 deletions
|
|
@ -75,9 +75,14 @@ function checkEmailDeliverability(string $email, string $apiKey): bool
|
|||
$curlError = curl_error($ch);
|
||||
curl_close($ch);
|
||||
|
||||
if ($response === false || $httpCode !== 200) {
|
||||
error_log('[WP] Emailable check failed (HTTP ' . $httpCode . '): ' . $curlError);
|
||||
return true; // fail open
|
||||
if ($response === false) {
|
||||
error_log('[WP] Emailable network error: ' . $curlError);
|
||||
return true; // fail open on network/timeout only
|
||||
}
|
||||
|
||||
if ($httpCode !== 200) {
|
||||
error_log('[WP] Emailable API error (HTTP ' . $httpCode . '): ' . $response);
|
||||
return false; // fail closed on auth/server errors
|
||||
}
|
||||
|
||||
$data = json_decode($response, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue