From cd265e4459149258232dc0943db3228bb0e5a7fa Mon Sep 17 00:00:00 2001 From: striker Date: Sun, 15 Mar 2026 01:15:23 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20contact=20form=20=E2=80=94=20email=20fal?= =?UTF-8?q?lback=20+=20non-fatal=20Telegram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Always send email to info@sag24.ru (via server mail()) - Return success even if Telegram is unreachable (ТСПУ blocks 45.10.53.x) Co-Authored-By: Claude Sonnet 4.6 --- public/api/contact.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/public/api/contact.php b/public/api/contact.php index d6d7093..2037451 100644 --- a/public/api/contact.php +++ b/public/api/contact.php @@ -56,9 +56,15 @@ $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); -if ($httpCode === 200) { - echo json_encode(['success' => true]); -} else { - http_response_code(500); - echo json_encode(['error' => 'Failed to send notification']); -} +// Email fallback (always send, regardless of Telegram result) +$subject = "Заявка с сag24.ru от {$name}"; +$body = "Имя: {$name}\n"; +if ($phone) $body .= "Телефон: {$phone}\n"; +if ($email) $body .= "Email: {$email}\n"; +$body .= "\nСообщение:\n{$message}\n"; +$body .= "\n" . date('d.m.Y H:i', time() + 3 * 3600) . " MSK"; +$headers = "From: noreply@sag24.ru\r\nContent-Type: text/plain; charset=UTF-8"; +mail('info@sag24.ru', $subject, $body, $headers); + +// Return success regardless of Telegram result +echo json_encode(['success' => true]);