CharSet = 'UTF-8'; if (USE_SMTP) { $mail->isSMTP(); $mail->Host = SMTP_HOST; $mail->SMTPAuth = true; $mail->Username = SMTP_USERNAME; $mail->Password = SMTP_PASSWORD; $mail->SMTPSecure = SMTP_SECURE; $mail->Port = SMTP_PORT; } // Empfänger $mail->setFrom(MAIL_FROM, MAIL_FROM_NAME); $mail->addAddress(MAIL_TO, 'Andreas Baumer'); $mail->addReplyTo($email, $name); // Inhalt $mail->isHTML(true); $mail->Subject = 'Neue Anfrage über Kontaktformular'; // E-Mail-Body $mailBody = '

Neue Kontaktanfrage

Baumer Maschinenverleih

Name:
' . $name . '
E-Mail:
' . (!empty($phone) ? '
Telefon:
' : '') . ' ' . (!empty($maschine) ? '
Gewünschte Maschine:
' . $maschine . '
' : '') . ' ' . (!empty($zeitraum) ? '
Gewünschter Zeitraum:
' . $zeitraum . '
' : '') . '
Nachricht:
' . nl2br($nachricht) . '
'; $mail->Body = $mailBody; // Alternative Text-Version (für E-Mail-Clients ohne HTML) $mail->AltBody = "Neue Kontaktanfrage - Baumer Maschinenverleih\n\n" . "Name: $name\n" . "E-Mail: $email\n" . ($phone ? "Telefon: $phone\n" : "") . ($maschine ? "Gewünschte Maschine: $maschine\n" : "") . ($zeitraum ? "Gewünschter Zeitraum: $zeitraum\n" : "") . "\nNachricht:\n$nachricht\n\n" . "---\n" . "IP: " . $_SERVER['REMOTE_ADDR'] . "\n" . "Zeitpunkt: " . date('d.m.Y H:i:s'); // E-Mail senden $mail->send(); // Erfolg - weiterleiten header('Location: ' . SUCCESS_URL); exit; } catch (Exception $e) { // Fehler loggen error_log("Mail-Fehler: {$mail->ErrorInfo}"); // Fehlerseite header('Location: ' . ERROR_URL . '&reason=send_error'); exit; } ?>