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

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-06-08 15:14:15 +02:00
parent 9c2e1ee4fa
commit 4705433238

View file

@ -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);