Repository navigation
Expand file tree
/
Copy pathcontact.php
More file actions
446 lines (400 loc) · 20.3 KB
/
Copy pathcontact.php
File metadata and controls
446 lines (400 loc) · 20.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<?php
/**
* ============================================================================
* www.meshdoc.de - MeshDoc — 3D Print Mesh Repair & Analyzer
* Hetzner Server Kontaktformular Backend (PHP 7.4 - PHP 8.4+)
* ============================================================================
*/
ini_set('display_errors', 0);
error_reporting(E_ALL);
// CORS: only our own origins (the form is served from the same domain, so this is just a safety net)
$allowed_origins = ['https://www.meshdoc.de', 'https://meshdoc.de'];
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
if ($origin !== '' && in_array($origin, $allowed_origins, true)) {
header('Access-Control-Allow-Origin: ' . $origin);
header('Vary: Origin');
}
header('Access-Control-Allow-Methods: POST, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type, Accept, X-Requested-With');
header('Content-Type: application/json; charset=utf-8');
header('X-Content-Type-Options: nosniff');
header('X-Frame-Options: SAMEORIGIN');
// Handle preflight OPTIONS request
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
http_response_code(200);
echo json_encode(['status' => 'ok']);
exit;
}
// Nur POST-Anfragen erlauben
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
echo json_encode([
'success' => false,
'error' => 'Method Not Allowed. Only POST requests are accepted.'
]);
exit;
}
// ============================================================================
// SMTP (optional): confirmation mail via an authenticated mailbox, so the mail server signs it (DKIM)
// Credentials live in mail-config.php (one level above the web root, or next to this file; never in the code)
// ============================================================================
function meshdoc_load_mail_config() {
static $cached = false;
if ($cached !== false) { return $cached; }
$cached = null;
foreach ([dirname(__DIR__) . '/meshdoc-mail-config.php', __DIR__ . '/mail-config.php'] as $f) {
if (is_file($f)) {
// a broken config file (syntax error etc.) must never break the contact form: catch it and fall back to mail()
try {
$c = @include $f;
} catch (\Throwable $e) {
error_log('[MeshDoc Contact] mail config unreadable: ' . $e->getMessage());
continue;
}
if (is_array($c) && !empty($c['host']) && !empty($c['user']) && isset($c['pass'])) { $cached = $c; return $c; }
}
}
return null;
}
function meshdoc_smtp_read($fp) {
$out = '';
while (($line = fgets($fp, 515)) !== false) {
$out .= $line;
if (strlen($line) < 4 || $line[3] === ' ') { break; }
}
return $out;
}
function meshdoc_smtp_cmd($fp, $cmd, $expect) {
global $meshdoc_smtp_err;
if ($cmd !== null) { fwrite($fp, $cmd . "\r\n"); }
$res = meshdoc_smtp_read($fp);
if (strpos($res, (string)$expect) === 0) { return $res; }
// log which step failed and what the server answered (never the password)
$step = ($cmd === null) ? 'greeting/data' : preg_replace('/^(AUTH LOGIN|[A-Z]+).*/', '$1', $cmd);
if ($cmd !== null && strpos($cmd, ' ') === false && !in_array($cmd, ['DATA', 'QUIT', 'STARTTLS', 'AUTH LOGIN'], true)) { $step = 'AUTH credentials'; }
$meshdoc_smtp_err = $step . ' -> ' . trim(substr($res, 0, 200));
return false;
}
/** Sends one prepared message. Returns true on success. $headers is an array of header lines (without To/Subject). */
function meshdoc_smtp_send($cfg, $from, $to, $subject_encoded, $headers, $body) {
$host = $cfg['host'];
$port = isset($cfg['port']) ? (int)$cfg['port'] : 587;
$sec = isset($cfg['security']) ? $cfg['security'] : ($port === 465 ? 'ssl' : 'tls'); // ssl | tls | none
$ctx = stream_context_create(['ssl' => ['verify_peer' => true, 'verify_peer_name' => true, 'peer_name' => isset($cfg['peer_name']) ? $cfg['peer_name'] : $host]]);
global $meshdoc_smtp_err;
$meshdoc_smtp_err = '';
$fp = @stream_socket_client(($sec === 'ssl' ? 'ssl://' : 'tcp://') . $host . ':' . $port, $errno, $errstr, 10, STREAM_CLIENT_CONNECT, $ctx);
if (!$fp) { $meshdoc_smtp_err = 'connect ' . $host . ':' . $port . ' -> ' . $errstr; return false; }
stream_set_timeout($fp, 15);
$ok = false;
$ehlo_name = isset($cfg['helo']) ? $cfg['helo'] : 'meshdoc.de';
do {
if (!meshdoc_smtp_cmd($fp, null, 220)) { break; }
if (!meshdoc_smtp_cmd($fp, 'EHLO ' . $ehlo_name, 250)) { break; }
if ($sec === 'tls') {
if (!meshdoc_smtp_cmd($fp, 'STARTTLS', 220)) { break; }
if (!@stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { $meshdoc_smtp_err = 'STARTTLS handshake/certificate failed'; break; }
if (!meshdoc_smtp_cmd($fp, 'EHLO ' . $ehlo_name, 250)) { break; }
}
if (!meshdoc_smtp_cmd($fp, 'AUTH LOGIN', 334)) { break; }
if (!meshdoc_smtp_cmd($fp, base64_encode($cfg['user']), 334)) { break; }
if (!meshdoc_smtp_cmd($fp, base64_encode($cfg['pass']), 235)) { break; }
if (!meshdoc_smtp_cmd($fp, 'MAIL FROM:<' . $from . '>', 250)) { break; }
if (!meshdoc_smtp_cmd($fp, 'RCPT TO:<' . $to . '>', 250)) { break; }
if (!meshdoc_smtp_cmd($fp, 'DATA', 354)) { break; }
$msg = 'Date: ' . date('r') . "\r\n" . 'To: <' . $to . ">\r\n" . 'Subject: ' . $subject_encoded . "\r\n" . implode("\r\n", $headers) . "\r\n\r\n" . $body;
$msg = preg_replace('/^\./m', '..', str_replace(["\r\n", "\r", "\n"], "\n", $msg));
$msg = str_replace("\n", "\r\n", $msg);
fwrite($fp, $msg . "\r\n.\r\n");
if (!meshdoc_smtp_cmd($fp, null, 250)) { break; }
$ok = true;
} while (false);
@fwrite($fp, "QUIT\r\n");
@fclose($fp);
return $ok;
}
// ============================================================================
// KONFIGURATION (MESHDOC.DE)
// ============================================================================
// 1. Ziel-E-Mail-Adresse (Ausschliesslich info@meshdoc.de)
$RECIPIENT_EMAIL = 'info@meshdoc.de';
// 2. Absender-Adresse (fuer Hetzner SPF/DMARC auf der Domain meshdoc.de)
$FROM_EMAIL = 'info@meshdoc.de';
$FROM_NAME = 'MeshDoc [www.meshdoc.de]';
// 2b. Absender der automatischen Eingangsbestaetigung (keine Antworten gelesen)
$NOREPLY_EMAIL = 'noreply@meshdoc.de';
// 3. E-Mail-Betreff-Praefix
$SUBJECT_PREFIX = '[MeshDoc - www.meshdoc.de]';
// ============================================================================
// DATEN EXTRAHIEREN & ENTKODIEREN
// ============================================================================
$raw_input = file_get_contents('php://input', false, null, 0, 20000);
$data = [];
if (!empty($raw_input) && ($json = json_decode($raw_input, true)) && is_array($json)) {
$data = $json;
} else {
$data = $_POST;
}
// 1. Anti-Spam Honeypot Pruefung
if (!empty($data['contact_hp']) || !empty($data['website'])) {
echo json_encode([
'success' => true,
'message' => 'Vielen Dank! Ihre Nachricht wurde sicher übertragen.'
]);
exit;
}
// 2. Rate Limiting per IP (no session / no cookie): max. 1 request per 10 s and 5 per hour.
// Only a salted hash of the IP is used as file name, files live in the system temp dir and are cleaned up after 2 days.
$client_ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'unknown';
$rate_dir = rtrim(sys_get_temp_dir(), '/\\') . '/meshdoc_rl2';
if (!is_dir($rate_dir)) {
@mkdir($rate_dir, 0700, true);
}
$rate_file = $rate_dir . '/' . hash('sha256', 'meshdoc-rl|' . $client_ip) . '.json';
$now = time();
$hits = [];
if (is_file($rate_file)) {
$stored = json_decode((string)@file_get_contents($rate_file), true);
if (is_array($stored)) {
foreach ($stored as $t) {
if (is_int($t) && ($now - $t) < 3600) {
$hits[] = $t;
}
}
}
}
if (count($hits) >= 5 || (count($hits) > 0 && ($now - max($hits)) < 10)) {
http_response_code(429);
echo json_encode([
'success' => false,
'error' => 'Bitte warte einen Moment, bevor du die nächste Anfrage sendest.'
]);
exit;
}
// Global daily cap (all IPs together): protects against many different IPs and keeps the mail server from being flooded.
$GLOBAL_DAILY_MAX = 20;
$global_file = $rate_dir . '/global_' . gmdate('Ymd') . '.txt';
$global_count = is_file($global_file) ? (int)@file_get_contents($global_file) : 0;
if ($global_count >= $GLOBAL_DAILY_MAX) {
http_response_code(429);
echo json_encode([
'success' => false,
'error' => 'Heute sind zu viele Nachrichten eingegangen. Bitte schreibe direkt an info@meshdoc.de.'
]);
exit;
}
// Failed attempts (invalid input) also count, so invalid requests cannot be sent without limit: max. 8 per hour and IP.
$fail_file = $rate_dir . '/f_' . hash('sha256', 'meshdoc-rl-f|' . $client_ip) . '.json';
$fails = [];
if (is_file($fail_file)) {
$fs = json_decode((string)@file_get_contents($fail_file), true);
if (is_array($fs)) { foreach ($fs as $t) { if (is_int($t) && ($now - $t) < 3600) { $fails[] = $t; } } }
}
if (count($fails) >= 8) {
http_response_code(429);
echo json_encode([
'success' => false,
'error' => 'Zu viele Versuche. Bitte warte eine Stunde.'
]);
exit;
}
$fails[] = $now;
@file_put_contents($fail_file, json_encode($fails), LOCK_EX);
// opportunistic cleanup of old files
if (mt_rand(1, 50) === 1) {
foreach ((array)@glob($rate_dir . '/*.{json,txt}', GLOB_BRACE) as $old) {
if (is_file($old) && ($now - (int)@filemtime($old)) > 172800) {
@unlink($old);
}
}
}
// 3. Eingabedaten bereinigen & validieren
$name = isset($data['name']) ? trim(strip_tags((string)$data['name'])) : '';
$email = isset($data['email']) ? trim((string)$data['email']) : '';
$message = isset($data['message']) ? trim(strip_tags((string)$data['message'])) : '';
$privacy = isset($data['privacy']) && filter_var($data['privacy'], FILTER_VALIDATE_BOOLEAN);
// Header-Injection-Schutz
$name = preg_replace('/[\x00-\x1F\x7F]+/u', ' ', $name);
$email = preg_replace('/[\x00-\x1F\x7F\s]+/u', '', $email);
$name = trim($name);
if (mb_strlen($name) < 2 || mb_strlen($name) > 100) {
http_response_code(400);
echo json_encode([
'success' => false,
'error' => 'Bitte geben Sie einen gültigen Namen ein (mindestens 2 Zeichen).'
]);
exit;
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
http_response_code(400);
echo json_encode([
'success' => false,
'error' => 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'
]);
exit;
}
// The domain of the address must be able to receive mail (catches typos and invented addresses)
$email_domain = substr(strrchr($email, '@'), 1);
if (function_exists('checkdnsrr') && !checkdnsrr($email_domain . '.', 'MX') && !checkdnsrr($email_domain . '.', 'A')) {
http_response_code(400);
echo json_encode([
'success' => false,
'error' => 'Bitte geben Sie eine gültige E-Mail-Adresse ein.'
]);
exit;
}
if (mb_strlen($message) < 10 || mb_strlen($message) > 5000) {
http_response_code(400);
echo json_encode([
'success' => false,
'error' => 'Die Nachricht muss mindestens 10 Zeichen lang sein.'
]);
exit;
}
if (!$privacy) {
http_response_code(400);
echo json_encode([
'success' => false,
'error' => 'Bitte stimmen Sie der Datenschutzerklärung zu.'
]);
exit;
}
// ============================================================================
// 1. BENACHRICHTIGUNG AN DEN BETREIBER ERSTELLEN & VERSENDEN
// ============================================================================
$subject = $SUBJECT_PREFIX . ' Neue Nachricht von ' . $name;
if (function_exists('mb_encode_mimeheader')) {
$encoded_subject = mb_encode_mimeheader($subject, 'UTF-8', 'B');
$encoded_from_name = mb_encode_mimeheader($FROM_NAME, 'UTF-8', 'B');
} else {
$encoded_subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
$encoded_from_name = '=?UTF-8?B?' . base64_encode($FROM_NAME) . '?=';
}
$encoded_reply_name = function_exists('mb_encode_mimeheader')
? mb_encode_mimeheader(str_replace(['"', '\\'], '', $name), 'UTF-8', 'B')
: '=?UTF-8?B?' . base64_encode($name) . '?=';
$sender_ip = $client_ip;
$timestamp = date('d.m.Y H:i:s') . ' Uhr';
// Uebersichtlicher, eindeutig gebrandeter E-Mail-Text
$body_text = "========================================================================\r\n";
$body_text .= "NEUE KONTAKTANFRAGE UEBER DEINE WEBSEITE: www.meshdoc.de\r\n";
$body_text .= "Tool: MeshDoc — 3D Print Mesh Repair & Analyzer\r\n";
$body_text .= "========================================================================\r\n\r\n";
$body_text .= "ABSENDER-DETAILS:\r\n";
$body_text .= "------------------------------------------------------------------------\r\n";
$body_text .= "Name: " . $name . "\r\n";
$body_text .= "E-Mail: " . $email . " (Antworten geht direkt an diesen Absender)\r\n";
$body_text .= "Datum: " . $timestamp . "\r\n";
$body_text .= "IP-Adresse: " . $sender_ip . "\r\n";
$body_text .= "Website: https://www.meshdoc.de\r\n\r\n";
$body_text .= "NACHRICHT:\r\n";
$body_text .= "------------------------------------------------------------------------\r\n";
$body_text .= $message . "\r\n";
$body_text .= "------------------------------------------------------------------------\r\n\r\n";
$body_text .= "========================================================================\r\n";
$body_text .= "Generiert über das verschlüsselte Kontaktformular auf https://www.meshdoc.de\r\n";
$body_text .= "========================================================================\r\n";
// Multi-Tier E-Mail Versand an Betreiber (Ausschliesslich info@meshdoc.de)
$mail_sent = false;
$headers = [
'MIME-Version: 1.0',
'Content-Type: text/plain; charset=UTF-8; format=flowed',
'Content-Transfer-Encoding: 8bit',
'From: ' . $encoded_from_name . ' <' . $FROM_EMAIL . '>',
'Reply-To: ' . $encoded_reply_name . ' <' . $email . '>',
'X-Mailer: PHP/' . phpversion()
];
$additional_parameters = '-f ' . escapeshellarg($FROM_EMAIL);
// 1. Versand an info@meshdoc.de mit Envelope-Sender
$mail_sent = @mail($RECIPIENT_EMAIL, $encoded_subject, $body_text, implode("\r\n", $headers), $additional_parameters);
// Fallback ohne -f Parameter falls durch Server restringiert
if (!$mail_sent) {
$mail_sent = @mail($RECIPIENT_EMAIL, $encoded_subject, $body_text, implode("\r\n", $headers));
}
if ($mail_sent) {
$hits[] = $now;
@file_put_contents($rate_file, json_encode($hits), LOCK_EX);
@file_put_contents($global_file, (string)($global_count + 1), LOCK_EX);
// the confirmation goes to the typed address at most once per day (no mail bombing of third parties)
$auto_file = $rate_dir . '/a_' . hash('sha256', 'meshdoc-rl-a|' . strtolower($email)) . '.txt';
// test switch: 'test_mode' => true in the mail config switches the confirmation limits off (for testing only)
$cfg_test = meshdoc_load_mail_config();
$test_mode = is_array($cfg_test) && !empty($cfg_test['test_mode']);
$send_auto = $test_mode || !(is_file($auto_file) && ($now - (int)@filemtime($auto_file)) < 86400);
// ... and per IP at most once per hour
$auto_ip_file = $rate_dir . '/ai_' . hash('sha256', 'meshdoc-rl-ai|' . $client_ip) . '.txt';
if (!$test_mode && $send_auto && is_file($auto_ip_file) && ($now - (int)@filemtime($auto_ip_file)) < 3600) { $send_auto = false; }
// ========================================================================
// 2. SOFORTIGER DIREKTER AUTORESPONDER AN DEN ABSENDER ($email)
// ========================================================================
// Hinweis: Server-Autoresponder in Hetzner reagieren oft nicht auf Formulare,
// da Absender und Empfaenger intern sind (Loop-Schutz).
// Daher versendet dieses Skript die Bestaetigung direkt an den Kunden!
$auto_subject = '[MeshDoc] Eingangsbestätigung';
if (function_exists('mb_encode_mimeheader')) {
$encoded_auto_subject = mb_encode_mimeheader($auto_subject, 'UTF-8', 'B');
} else {
$encoded_auto_subject = '=?UTF-8?B?' . base64_encode($auto_subject) . '?=';
}
// Short confirmation only: the message text is NOT echoed back (prevents abuse as a spam relay).
// No raw URLs in the text: mail clients (e.g. Outlook Safelinks) rewrite them into long, ugly links.
$auto_text = "Hallo,\r\n\r\n";
$auto_text .= "deine Nachricht an MeshDoc ist bei uns eingegangen. Wir melden uns schnellstmöglich bei dir.\r\n\r\n";
$auto_text .= "Du hast keine Nachricht geschickt? Dann ignoriere diese E-Mail einfach.\r\n\r\n";
$auto_text .= "Dein MeshDoc-Team\r\n\r\n";
$auto_text .= "-- \r\n";
$auto_text .= "Automatische Bestätigung. Antworten an diese Adresse werden nicht gelesen. Wir melden uns von info@meshdoc.de.";
$auto_html = '<!DOCTYPE html><html lang="de"><body style="margin:0;padding:24px;font-family:Arial,Helvetica,sans-serif;font-size:15px;line-height:1.5;color:#222">'
. '<p>Hallo,</p>'
. '<p>deine Nachricht an MeshDoc ist bei uns eingegangen. Wir melden uns schnellstmöglich bei dir.</p>'
. '<p>Du hast keine Nachricht geschickt? Dann ignoriere diese E-Mail einfach.</p>'
. '<p>Dein <a href="https://www.meshdoc.de/" style="color:#0a7a8f">MeshDoc</a>-Team</p>'
. '<p style="margin-top:24px;font-size:12px;color:#666">Automatische Bestätigung. Antworten an diese Adresse werden nicht gelesen. Wir melden uns von info@meshdoc.de.</p>'
. '</body></html>';
$boundary = 'md_' . bin2hex(random_bytes(8));
$auto_body = "--$boundary\r\nContent-Type: text/plain; charset=UTF-8\r\nContent-Transfer-Encoding: base64\r\n\r\n" . chunk_split(base64_encode($auto_text)) . "\r\n";
$auto_body .= "--$boundary\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Transfer-Encoding: base64\r\n\r\n" . chunk_split(base64_encode($auto_html)) . "\r\n";
$auto_body .= "--$boundary--\r\n";
$auto_headers = [
'MIME-Version: 1.0',
'Content-Type: multipart/alternative; boundary="' . $boundary . '"',
'From: ' . $encoded_from_name . ' <' . $NOREPLY_EMAIL . '>',
'Message-ID: <' . bin2hex(random_bytes(12)) . '@meshdoc.de>',
'Auto-Submitted: auto-replied',
'X-Auto-Response-Suppress: All'
];
// envelope sender stays the known-good mailbox (the noreply address is only the visible From)
$auto_parameters = '-f ' . escapeshellarg($FROM_EMAIL);
if (!$send_auto) { error_log('[MeshDoc Contact] confirmation skipped (limit: once per address/day or per IP/hour)'); }
if ($send_auto) {
$auto_sent = false;
$smtp_cfg = meshdoc_load_mail_config();
if (!$smtp_cfg) { error_log('[MeshDoc Contact] no mail config found, using mail()'); }
if ($smtp_cfg) {
// authenticated mailbox: the mail server signs the message (DKIM), SPF/DMARC align with meshdoc.de
$smtp_from = !empty($smtp_cfg['from']) ? $smtp_cfg['from'] : $NOREPLY_EMAIL;
$auto_sent = meshdoc_smtp_send($smtp_cfg, $smtp_from, $email, $encoded_auto_subject, $auto_headers, $auto_body);
if (!$auto_sent) { global $meshdoc_smtp_err; error_log('[MeshDoc Contact] SMTP send failed (' . $meshdoc_smtp_err . '), falling back to mail()'); }
}
if (!$auto_sent) { $auto_sent = @mail($email, $encoded_auto_subject, $auto_body, implode("\r\n", $auto_headers), $auto_parameters); }
if (!$auto_sent) { $auto_sent = @mail($email, $encoded_auto_subject, $auto_body, implode("\r\n", $auto_headers)); }
if ($auto_sent) {
error_log('[MeshDoc Contact] confirmation accepted by ' . (!empty($smtp_cfg) && empty($meshdoc_smtp_err) ? 'SMTP' : 'mail()'));
@file_put_contents($auto_file, '1', LOCK_EX);
@file_put_contents($auto_ip_file, '1', LOCK_EX);
} else {
error_log('[MeshDoc Contact] confirmation mail failed (SMTP and mail())');
}
}
echo json_encode([
'success' => true,
'message' => 'Vielen Dank! Deine Nachricht wurde erfolgreich versendet.'
]);
} else {
error_log('[MeshDoc Contact] PHP mail() failed for: ' . $RECIPIENT_EMAIL);
http_response_code(500);
echo json_encode([
'success' => false,
'error' => 'Der Mailserver konnte die Nachricht nicht direkt zustellen. Bitte schreibe uns direkt an info@meshdoc.de.'
]);
}