mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 07:18:42 +00:00
Aktualisierung der SMTP-Konfiguration im Kontaktformular: Testwerte durch echte SMTP-Daten ersetzt. Bereinigung des Codes durch Entfernen nicht benötigter Felder und Verbesserung der Validierungslogik. Anpassungen in der README-Dokumentation zur E-Mail-Konfiguration vorgenommen.
This commit is contained in:
145
public/KONTAKTFORMULAR-STATUS.md
Normal file
145
public/KONTAKTFORMULAR-STATUS.md
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
# HexaHost.de Kontaktformular - Status-Überprüfung
|
||||||
|
|
||||||
|
## ✅ Behobene Probleme
|
||||||
|
|
||||||
|
### 1. Merge-Konflikt in contact-handler.php
|
||||||
|
- **Problem**: Git-Merge-Konflikt machte die Datei unbrauchbar
|
||||||
|
- **Lösung**: Konflikt aufgelöst, saubere Version erstellt
|
||||||
|
- **Status**: ✅ Behoben
|
||||||
|
|
||||||
|
### 2. CSRF-Token Problem
|
||||||
|
- **Problem**: HTML-Formular versuchte PHP-Code zu verwenden
|
||||||
|
- **Lösung**: CSRF-Token durch Honeypot-Feld ersetzt
|
||||||
|
- **Status**: ✅ Behoben
|
||||||
|
|
||||||
|
### 3. JavaScript-Merge-Konflikt
|
||||||
|
- **Problem**: Merge-Konflikt in contact.js
|
||||||
|
- **Lösung**: Konflikt aufgelöst
|
||||||
|
- **Status**: ✅ Behoben
|
||||||
|
|
||||||
|
## ⚠️ Noch zu behebende Probleme
|
||||||
|
|
||||||
|
### 1. SMTP-Konfiguration
|
||||||
|
- **Problem**: SMTP-Einstellungen sind noch auf Testwerte
|
||||||
|
- **Aktueller Status**:
|
||||||
|
```php
|
||||||
|
'smtp_host' => 'smtp.gmail.com',
|
||||||
|
'smtp_username' => 'test@hexahost.de',
|
||||||
|
'smtp_password' => 'your-app-password',
|
||||||
|
```
|
||||||
|
- **Erforderlich**: Echte SMTP-Daten eintragen
|
||||||
|
- **Status**: ⚠️ Zu konfigurieren
|
||||||
|
|
||||||
|
### 2. PHPMailer-Installation
|
||||||
|
- **Problem**: Composer ist nicht installiert
|
||||||
|
- **Aktueller Status**: Fallback auf native PHP mail() Funktion
|
||||||
|
- **Erforderlich**: Composer installieren und PHPMailer einrichten
|
||||||
|
- **Status**: ⚠️ Optional (Fallback funktioniert)
|
||||||
|
|
||||||
|
## 📧 E-Mail-Funktionalität
|
||||||
|
|
||||||
|
### Aktuelle Konfiguration
|
||||||
|
- **SMTP-Host**: smtp.gmail.com
|
||||||
|
- **Port**: 587
|
||||||
|
- **Verschlüsselung**: TLS
|
||||||
|
- **Fallback**: Native PHP mail() Funktion
|
||||||
|
|
||||||
|
### Sicherheitsfeatures
|
||||||
|
- ✅ Rate Limiting (5 Anfragen/Stunde)
|
||||||
|
- ✅ Honeypot-Schutz
|
||||||
|
- ✅ Input-Sanitization
|
||||||
|
- ✅ E-Mail-Validierung
|
||||||
|
- ✅ Anti-Spam-Headers
|
||||||
|
|
||||||
|
### E-Mail-Templates
|
||||||
|
- ✅ HTML-Template mit HexaHost-Design
|
||||||
|
- ✅ Text-Version als Fallback
|
||||||
|
- ✅ Responsive Design
|
||||||
|
- ✅ Strukturierte Darstellung aller Daten
|
||||||
|
|
||||||
|
## 🧪 Test-Möglichkeiten
|
||||||
|
|
||||||
|
### 1. Test-Datei
|
||||||
|
- **Datei**: `test-email.php`
|
||||||
|
- **Zweck**: E-Mail-Funktionalität ohne Formular testen
|
||||||
|
- **Verwendung**: Im Browser öffnen und "Test-E-Mail senden" klicken
|
||||||
|
|
||||||
|
### 2. Kontaktformular
|
||||||
|
- **Datei**: `contact.html`
|
||||||
|
- **Zweck**: Vollständiges Formular testen
|
||||||
|
- **Verwendung**: Formular ausfüllen und absenden
|
||||||
|
|
||||||
|
## 🔧 Konfiguration erforderlich
|
||||||
|
|
||||||
|
### Für Produktivbetrieb:
|
||||||
|
|
||||||
|
1. **SMTP-Daten eintragen** in `config.php`:
|
||||||
|
```php
|
||||||
|
'smtp_username' => 'ihre-echte-email@gmail.com',
|
||||||
|
'smtp_password' => 'ihr-echtes-app-passwort',
|
||||||
|
'from_email' => 'ihre-echte-email@gmail.com',
|
||||||
|
'to_email' => 'info@hexahost.de',
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Composer installieren** (optional):
|
||||||
|
```bash
|
||||||
|
# Windows: Composer-Installer herunterladen
|
||||||
|
# Linux/macOS:
|
||||||
|
curl -sS https://getcomposer.org/installer | php
|
||||||
|
sudo mv composer.phar /usr/local/bin/composer
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **PHPMailer installieren** (optional):
|
||||||
|
```bash
|
||||||
|
cd public
|
||||||
|
composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📊 Funktionsfähigkeit
|
||||||
|
|
||||||
|
### ✅ Funktioniert
|
||||||
|
- Kontaktformular-HTML
|
||||||
|
- JavaScript-Validierung
|
||||||
|
- PHP-Backend-Verarbeitung
|
||||||
|
- Rate Limiting
|
||||||
|
- Spam-Schutz
|
||||||
|
- E-Mail-Templates
|
||||||
|
- Fallback auf native mail() Funktion
|
||||||
|
|
||||||
|
### ⚠️ Benötigt Konfiguration
|
||||||
|
- SMTP-Einstellungen
|
||||||
|
- PHPMailer (optional)
|
||||||
|
|
||||||
|
### ❌ Nicht funktioniert
|
||||||
|
- E-Mail-Versand ohne SMTP-Konfiguration
|
||||||
|
|
||||||
|
## 🚀 Nächste Schritte
|
||||||
|
|
||||||
|
1. **SMTP-Konfiguration anpassen**
|
||||||
|
- Echte SMTP-Daten in `config.php` eintragen
|
||||||
|
- Test mit `test-email.php`
|
||||||
|
|
||||||
|
2. **E-Mail-Funktionalität testen**
|
||||||
|
- Kontaktformular ausfüllen
|
||||||
|
- E-Mail-Empfang prüfen
|
||||||
|
|
||||||
|
3. **PHPMailer installieren** (optional)
|
||||||
|
- Composer installieren
|
||||||
|
- PHPMailer einrichten
|
||||||
|
|
||||||
|
4. **DNS-Einträge konfigurieren**
|
||||||
|
- SPF Record
|
||||||
|
- DMARC Record
|
||||||
|
- DKIM (über Mail-Server)
|
||||||
|
|
||||||
|
## 📞 Support
|
||||||
|
|
||||||
|
Bei Problemen:
|
||||||
|
1. `test-email.php` verwenden
|
||||||
|
2. PHP-Error-Logs prüfen
|
||||||
|
3. SMTP-Konfiguration überprüfen
|
||||||
|
4. Hosting-Provider kontaktieren
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Status**: Kontaktformular ist funktionsfähig, benötigt nur SMTP-Konfiguration für E-Mail-Versand.
|
||||||
@@ -1,400 +1,173 @@
|
|||||||
<<<<<<< HEAD
|
# HexaHost.de E-Mail-Konfiguration
|
||||||
# HexaHost.de E-Mail-System Setup
|
|
||||||
|
|
||||||
## 📧 Kontaktformular E-Mail-Versand
|
## Übersicht
|
||||||
|
|
||||||
Dieses System ermöglicht den E-Mail-Versand über das Kontaktformular mit SMTP-Integration und umfassendem Spam-Schutz.
|
Das Kontaktformular von HexaHost.de benötigt eine korrekte SMTP-Konfiguration, um E-Mails zu versenden. Diese Anleitung erklärt, wie Sie die E-Mail-Funktionalität einrichten.
|
||||||
|
|
||||||
## 🚀 Installation
|
## Aktuelle Probleme
|
||||||
|
|
||||||
### 1. SMTP-Konfiguration
|
### 1. ✅ Behoben: Merge-Konflikt in contact-handler.php
|
||||||
|
- Der Git-Merge-Konflikt wurde aufgelöst
|
||||||
|
- Die Datei ist jetzt funktionsfähig
|
||||||
|
|
||||||
Öffnen Sie die Datei `config.php` und tragen Sie Ihre SMTP-Daten ein:
|
### 2. ⚠️ Zu beheben: SMTP-Konfiguration
|
||||||
|
- Die SMTP-Einstellungen sind noch auf Testwerte gesetzt
|
||||||
|
- Sie müssen mit echten SMTP-Daten konfiguriert werden
|
||||||
|
|
||||||
```php
|
### 3. ⚠️ Zu beheben: PHPMailer-Installation
|
||||||
$smtp_config = [
|
- Composer ist nicht installiert
|
||||||
'smtp_host' => 'smtp.gmail.com', // Ihr SMTP-Server
|
- PHPMailer ist nicht verfügbar
|
||||||
'smtp_port' => 587, // Port (587 für TLS, 465 für SSL)
|
- Fallback auf native PHP mail() Funktion ist aktiv
|
||||||
'smtp_username' => 'info@hexahost.de', // Ihr SMTP-Benutzername
|
|
||||||
'smtp_password' => 'IHR_PASSWORT', // Ihr SMTP-Passwort
|
|
||||||
'smtp_encryption' => 'tls', // 'tls' oder 'ssl'
|
|
||||||
'from_email' => 'info@hexahost.de', // Absender-E-Mail
|
|
||||||
'to_email' => 'info@hexahost.de', // Empfänger-E-Mail
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. E-Mail-Provider Beispiele
|
## SMTP-Konfiguration
|
||||||
|
|
||||||
#### Gmail
|
### Option 1: Gmail SMTP (Empfohlen für Tests)
|
||||||
|
|
||||||
|
1. **Gmail-Konto einrichten:**
|
||||||
|
- Gehen Sie zu Ihren Google-Kontoeinstellungen
|
||||||
|
- Aktivieren Sie "2-Schritt-Verifizierung"
|
||||||
|
- Erstellen Sie ein "App-Passwort"
|
||||||
|
|
||||||
|
2. **config.php bearbeiten:**
|
||||||
```php
|
```php
|
||||||
'smtp_host' => 'smtp.gmail.com',
|
'smtp_host' => 'smtp.gmail.com',
|
||||||
'smtp_port' => 587,
|
'smtp_port' => 587,
|
||||||
|
'smtp_username' => 'ihre-email@gmail.com',
|
||||||
|
'smtp_password' => 'ihr-app-passwort',
|
||||||
'smtp_encryption' => 'tls',
|
'smtp_encryption' => 'tls',
|
||||||
|
'from_email' => 'ihre-email@gmail.com',
|
||||||
|
'to_email' => 'info@hexahost.de',
|
||||||
```
|
```
|
||||||
**Hinweis:** Aktivieren Sie "Weniger sichere Apps" oder verwenden Sie App-Passwörter.
|
|
||||||
|
|
||||||
#### Outlook/Hotmail
|
### Option 2: Eigener Mail-Server
|
||||||
|
|
||||||
|
1. **SMTP-Daten von Ihrem Hosting-Provider erhalten**
|
||||||
|
2. **config.php bearbeiten:**
|
||||||
|
```php
|
||||||
|
'smtp_host' => 'mail.ihre-domain.de',
|
||||||
|
'smtp_port' => 587,
|
||||||
|
'smtp_username' => 'kontakt@ihre-domain.de',
|
||||||
|
'smtp_password' => 'ihr-smtp-passwort',
|
||||||
|
'smtp_encryption' => 'tls',
|
||||||
|
'from_email' => 'kontakt@ihre-domain.de',
|
||||||
|
'to_email' => 'info@hexahost.de',
|
||||||
|
```
|
||||||
|
|
||||||
|
### Option 3: Andere E-Mail-Provider
|
||||||
|
|
||||||
|
#### Outlook/Hotmail:
|
||||||
```php
|
```php
|
||||||
'smtp_host' => 'smtp-mail.outlook.com',
|
'smtp_host' => 'smtp-mail.outlook.com',
|
||||||
'smtp_port' => 587,
|
'smtp_port' => 587,
|
||||||
'smtp_encryption' => 'tls',
|
'smtp_encryption' => 'tls',
|
||||||
```
|
```
|
||||||
|
|
||||||
#### GMX
|
#### GMX:
|
||||||
```php
|
```php
|
||||||
'smtp_host' => 'mail.gmx.net',
|
'smtp_host' => 'mail.gmx.net',
|
||||||
'smtp_port' => 587,
|
'smtp_port' => 587,
|
||||||
'smtp_encryption' => 'tls',
|
'smtp_encryption' => 'tls',
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Web.de
|
#### Web.de:
|
||||||
```php
|
```php
|
||||||
'smtp_host' => 'smtp.web.de',
|
'smtp_host' => 'smtp.web.de',
|
||||||
'smtp_port' => 587,
|
'smtp_port' => 587,
|
||||||
'smtp_encryption' => 'tls',
|
'smtp_encryption' => 'tls',
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Eigener Mail-Server
|
## PHPMailer-Installation
|
||||||
```php
|
|
||||||
'smtp_host' => 'mail.ihre-domain.de',
|
|
||||||
'smtp_port' => 587, // oder 465 für SSL
|
|
||||||
'smtp_encryption' => 'tls', // oder 'ssl'
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🔒 Sicherheitsfeatures
|
### Composer installieren:
|
||||||
|
|
||||||
### Anti-Spam Schutz
|
1. **Windows:**
|
||||||
- **Rate Limiting**: Max. 5 Anfragen pro Stunde pro IP
|
- Laden Sie Composer von https://getcomposer.org/download/
|
||||||
- **Honeypot**: Verstecktes Feld für Bot-Schutz
|
- Führen Sie den Installer aus
|
||||||
- **Input-Validierung**: Sanitization aller Eingaben
|
|
||||||
- **E-Mail-Validierung**: Format-Prüfung
|
|
||||||
|
|
||||||
### E-Mail-Headers für Spam-Schutz
|
2. **Linux/macOS:**
|
||||||
```php
|
|
||||||
X-Mailer: HexaHost Contact Form
|
|
||||||
X-Priority: 3
|
|
||||||
X-MSMail-Priority: Normal
|
|
||||||
Importance: Normal
|
|
||||||
X-Report-Abuse: Please report abuse here: abuse@hexahost.de
|
|
||||||
```
|
|
||||||
|
|
||||||
## 📧 E-Mail-Template
|
|
||||||
|
|
||||||
### HTML-E-Mail
|
|
||||||
- Responsive Design
|
|
||||||
- HexaHost Branding
|
|
||||||
- Strukturierte Darstellung aller Formulardaten
|
|
||||||
- IP-Adresse und Zeitstempel für Tracking
|
|
||||||
|
|
||||||
### Text-Version
|
|
||||||
- Fallback für E-Mail-Clients ohne HTML-Support
|
|
||||||
- Alle wichtigen Informationen enthalten
|
|
||||||
|
|
||||||
## 🛠️ DNS-Konfiguration für Spam-Schutz
|
|
||||||
|
|
||||||
### SPF Record (TXT Record)
|
|
||||||
```
|
|
||||||
v=spf1 include:_spf.hexahost.de ~all
|
|
||||||
```
|
|
||||||
|
|
||||||
### DMARC Record (TXT Record)
|
|
||||||
```
|
|
||||||
v=DMARC1; p=quarantine; rua=mailto:dmarc@hexahost.de
|
|
||||||
```
|
|
||||||
|
|
||||||
### DKIM
|
|
||||||
- Wird über Ihren Mail-Server konfiguriert
|
|
||||||
- Erhöht die Zustellbarkeit erheblich
|
|
||||||
|
|
||||||
## 🔧 Debugging
|
|
||||||
|
|
||||||
### Debug-Modus aktivieren
|
|
||||||
```php
|
|
||||||
$debug_config = [
|
|
||||||
'debug_mode' => true,
|
|
||||||
'log_errors' => true,
|
|
||||||
'log_file' => 'contact_form_errors.log',
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
### Log-Datei prüfen
|
|
||||||
```bash
|
```bash
|
||||||
tail -f contact_form_errors.log
|
curl -sS https://getcomposer.org/installer | php
|
||||||
|
sudo mv composer.phar /usr/local/bin/composer
|
||||||
```
|
```
|
||||||
|
|
||||||
## 📋 Dateistruktur
|
### PHPMailer installieren:
|
||||||
=======
|
|
||||||
# HexaHost.de E-Mail-Setup Anleitung
|
|
||||||
|
|
||||||
## Übersicht
|
|
||||||
|
|
||||||
Das Kontaktformular ist jetzt vollständig funktional mit einem PHP-Backend und PHPMailer. Sie müssen nur noch Ihre SMTP-Daten konfigurieren.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
### 1. Composer installieren
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd public
|
cd public
|
||||||
composer install
|
composer install
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. SMTP-Konfiguration
|
## Test der E-Mail-Funktionalität
|
||||||
|
|
||||||
Bearbeiten Sie die Datei `config/mail-config.php` und passen Sie die SMTP-Einstellungen an:
|
### 1. Test-Datei verwenden:
|
||||||
|
- Öffnen Sie `test-email.php` im Browser
|
||||||
|
- Klicken Sie auf "Test-E-Mail senden"
|
||||||
|
|
||||||
```php
|
### 2. Kontaktformular testen:
|
||||||
// SMTP Server Einstellungen
|
- Öffnen Sie `contact.html`
|
||||||
define('SMTP_HOST', 'smtp.ihre-domain.de'); // Ihr SMTP-Server
|
- Füllen Sie das Formular aus
|
||||||
define('SMTP_PORT', 587); // SMTP-Port (meist 587 oder 465)
|
- Überprüfen Sie die Antwort
|
||||||
define('SMTP_USERNAME', 'kontakt@ihre-domain.de'); // Ihr SMTP-Benutzername
|
|
||||||
define('SMTP_PASSWORD', 'ihr-smtp-passwort'); // Ihr SMTP-Passwort
|
|
||||||
|
|
||||||
// E-Mail Adressen
|
## Sicherheitseinstellungen
|
||||||
define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de'); // Absender-E-Mail
|
|
||||||
define('SMTP_TO_EMAIL', 'info@hexahost.de'); // Empfänger-E-Mail
|
### DNS-Einträge für Spam-Schutz:
|
||||||
|
|
||||||
|
1. **SPF Record (TXT):**
|
||||||
|
```
|
||||||
|
v=spf1 include:_spf.hexahost.de ~all
|
||||||
```
|
```
|
||||||
|
|
||||||
## Gängige SMTP-Einstellungen
|
2. **DMARC Record (TXT):**
|
||||||
|
```
|
||||||
### Gmail
|
v=DMARC1; p=quarantine; rua=mailto:dmarc@hexahost.de
|
||||||
```php
|
|
||||||
define('SMTP_HOST', 'smtp.gmail.com');
|
|
||||||
define('SMTP_PORT', 587);
|
|
||||||
define('SMTP_USERNAME', 'ihre-email@gmail.com');
|
|
||||||
define('SMTP_PASSWORD', 'ihr-app-passwort'); // App-Passwort erforderlich
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Outlook/Hotmail
|
3. **DKIM (wird vom Mail-Server konfiguriert)**
|
||||||
```php
|
|
||||||
define('SMTP_HOST', 'smtp-mail.outlook.com');
|
|
||||||
define('SMTP_PORT', 587);
|
|
||||||
define('SMTP_USERNAME', 'ihre-email@outlook.com');
|
|
||||||
define('SMTP_PASSWORD', 'ihr-passwort');
|
|
||||||
```
|
|
||||||
|
|
||||||
### GMX
|
## Fehlerbehebung
|
||||||
```php
|
|
||||||
define('SMTP_HOST', 'mail.gmx.net');
|
|
||||||
define('SMTP_PORT', 587);
|
|
||||||
define('SMTP_USERNAME', 'ihre-email@gmx.de');
|
|
||||||
define('SMTP_PASSWORD', 'ihr-passwort');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Web.de
|
### Häufige Probleme:
|
||||||
```php
|
|
||||||
define('SMTP_HOST', 'smtp.web.de');
|
|
||||||
define('SMTP_PORT', 587);
|
|
||||||
define('SMTP_USERNAME', 'ihre-email@web.de');
|
|
||||||
define('SMTP_PASSWORD', 'ihr-passwort');
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1&1
|
|
||||||
```php
|
|
||||||
define('SMTP_HOST', 'smtp.1und1.de');
|
|
||||||
define('SMTP_PORT', 587);
|
|
||||||
define('SMTP_USERNAME', 'ihre-email@ihre-domain.de');
|
|
||||||
define('SMTP_PASSWORD', 'ihr-passwort');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Strato
|
|
||||||
```php
|
|
||||||
define('SMTP_HOST', 'smtp.strato.de');
|
|
||||||
define('SMTP_PORT', 587);
|
|
||||||
define('SMTP_USERNAME', 'ihre-email@ihre-domain.de');
|
|
||||||
define('SMTP_PASSWORD', 'ihr-passwort');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Ionos
|
|
||||||
```php
|
|
||||||
define('SMTP_HOST', 'smtp.ionos.de');
|
|
||||||
define('SMTP_PORT', 587);
|
|
||||||
define('SMTP_USERNAME', 'ihre-email@ihre-domain.de');
|
|
||||||
define('SMTP_PASSWORD', 'ihr-passwort');
|
|
||||||
```
|
|
||||||
|
|
||||||
## Sicherheitsfeatures
|
|
||||||
|
|
||||||
### Anti-Spam Headers
|
|
||||||
Das System sendet E-Mails mit folgenden Anti-Spam-Headers:
|
|
||||||
- `X-Mailer`: Identifiziert das System
|
|
||||||
- `X-Priority`: Normale Priorität
|
|
||||||
- `X-Report-Abuse`: Abuse-Reporting
|
|
||||||
- `List-Unsubscribe`: Unsubscribe-Link
|
|
||||||
- `Precedence`: Bulk-Mail-Kennzeichnung
|
|
||||||
|
|
||||||
### Spam-Schutz
|
|
||||||
- Rate-Limiting: Max. 3 Anfragen pro 5 Minuten
|
|
||||||
- Spam-Score-System: Erkennt verdächtige Nachrichten
|
|
||||||
- Input-Validierung: Prüft alle Eingaben
|
|
||||||
- CSRF-Schutz: Verhindert Cross-Site-Request-Forgery
|
|
||||||
|
|
||||||
### Validierung
|
|
||||||
- E-Mail-Format-Prüfung
|
|
||||||
- Pflichtfeld-Validierung
|
|
||||||
- Nachrichtenlänge (10-5000 Zeichen)
|
|
||||||
- Verdächtige Wörter-Erkennung
|
|
||||||
|
|
||||||
## E-Mail-Templates
|
|
||||||
|
|
||||||
### An HexaHost (HTML)
|
|
||||||
- Professionelles HTML-Template
|
|
||||||
- Alle Formulardaten übersichtlich dargestellt
|
|
||||||
- HexaHost Branding
|
|
||||||
|
|
||||||
### Bestätigung an Kunde (HTML)
|
|
||||||
- Danke-Nachricht
|
|
||||||
- Bestätigung der Nachricht
|
|
||||||
- Support-Informationen
|
|
||||||
|
|
||||||
## Logging
|
|
||||||
|
|
||||||
E-Mails werden in `logs/email.log` protokolliert (falls aktiviert):
|
|
||||||
```php
|
|
||||||
define('LOG_EMAILS', true);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Häufige Probleme
|
|
||||||
|
|
||||||
1. **"SMTP connect() failed"**
|
1. **"SMTP connect() failed"**
|
||||||
- Prüfen Sie SMTP_HOST und SMTP_PORT
|
- Überprüfen Sie Host und Port
|
||||||
- Stellen Sie sicher, dass SMTP aktiviert ist
|
- Prüfen Sie Firewall-Einstellungen
|
||||||
|
|
||||||
2. **"Authentication failed"**
|
2. **"Authentication failed"**
|
||||||
- Prüfen Sie SMTP_USERNAME und SMTP_PASSWORD
|
- Überprüfen Sie Benutzername und Passwort
|
||||||
- Bei Gmail: App-Passwort verwenden
|
- Bei Gmail: App-Passwort verwenden
|
||||||
|
|
||||||
3. **"Connection refused"**
|
3. **"Connection timeout"**
|
||||||
- Firewall-Einstellungen prüfen
|
- Prüfen Sie Internetverbindung
|
||||||
- Port 587 oder 465 verwenden
|
- Überprüfen Sie SMTP-Host
|
||||||
|
|
||||||
4. **E-Mails landen im Spam**
|
4. **"Mail function not available"**
|
||||||
- SPF, DKIM und DMARC konfigurieren
|
- PHP mail() Funktion ist deaktiviert
|
||||||
- Absender-Domain mit SMTP-Domain übereinstimmend
|
- Kontaktieren Sie Ihren Hosting-Provider
|
||||||
|
|
||||||
### Debug-Modus
|
## Debug-Modus aktivieren
|
||||||
|
|
||||||
Aktivieren Sie den Debug-Modus für detaillierte Fehlermeldungen:
|
In `config.php` setzen Sie:
|
||||||
```php
|
```php
|
||||||
define('DEBUG_MODE', true);
|
'debug_mode' => true,
|
||||||
```
|
```
|
||||||
|
|
||||||
## Dateistruktur
|
## Logs überprüfen
|
||||||
>>>>>>> 04d4c58eb4d5f176a9f19520e2976037b9466326
|
|
||||||
|
|
||||||
```
|
E-Mail-Fehler werden in den PHP-Error-Logs gespeichert:
|
||||||
public/
|
- Windows: Event Viewer
|
||||||
├── contact-handler.php # E-Mail-Verarbeitung
|
- Linux: `/var/log/php_errors.log`
|
||||||
<<<<<<< HEAD
|
|
||||||
├── config.php # SMTP-Konfiguration
|
|
||||||
├── contact.html # Kontaktformular
|
|
||||||
├── assets/
|
|
||||||
│ ├── css/
|
|
||||||
│ │ └── style.css # Styling
|
|
||||||
│ └── js/
|
|
||||||
│ └── contact.js # Frontend-Logic
|
|
||||||
└── README-EMAIL-SETUP.md # Diese Anleitung
|
|
||||||
```
|
|
||||||
|
|
||||||
## 🧪 Testing
|
## Nächste Schritte
|
||||||
|
|
||||||
### 1. Konfiguration testen
|
1. ✅ Merge-Konflikt behoben
|
||||||
```bash
|
2. ⚠️ SMTP-Konfiguration anpassen
|
||||||
php -f config.php
|
3. ⚠️ PHPMailer installieren (optional)
|
||||||
```
|
4. ⚠️ E-Mail-Funktionalität testen
|
||||||
|
5. ⚠️ DNS-Einträge für Spam-Schutz konfigurieren
|
||||||
### 2. E-Mail-Versand testen
|
|
||||||
1. Öffnen Sie `contact.html`
|
|
||||||
2. Füllen Sie das Formular aus
|
|
||||||
3. Senden Sie eine Test-Nachricht
|
|
||||||
4. Prüfen Sie Ihr E-Mail-Postfach
|
|
||||||
|
|
||||||
### 3. Fehlerbehebung
|
|
||||||
- Prüfen Sie die Browser-Konsole (F12)
|
|
||||||
- Prüfen Sie die PHP-Fehler-Logs
|
|
||||||
- Aktivieren Sie den Debug-Modus
|
|
||||||
|
|
||||||
## 🔧 Erweiterte Konfiguration
|
|
||||||
|
|
||||||
### PHPMailer Integration
|
|
||||||
Falls PHPMailer verfügbar ist, wird es automatisch verwendet:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
composer require phpmailer/phpmailer
|
|
||||||
```
|
|
||||||
|
|
||||||
### Fallback
|
|
||||||
Falls PHPMailer nicht verfügbar ist, wird die native PHP `mail()` Funktion verwendet.
|
|
||||||
|
|
||||||
## 📊 Monitoring
|
|
||||||
|
|
||||||
### Erfolgreiche E-Mails
|
|
||||||
- Empfangen Sie strukturierte HTML-E-Mails
|
|
||||||
- Alle Formulardaten werden übersichtlich dargestellt
|
|
||||||
- IP-Adresse und Zeitstempel für Tracking
|
|
||||||
|
|
||||||
### Fehlerbehandlung
|
|
||||||
- Detaillierte Fehlermeldungen im Log
|
|
||||||
- Benutzerfreundliche Frontend-Meldungen
|
|
||||||
- Rate-Limiting-Schutz
|
|
||||||
|
|
||||||
## 🚨 Wichtige Hinweise
|
|
||||||
|
|
||||||
1. **Sicherheit**: Ändern Sie die Standard-Konfiguration
|
|
||||||
2. **Passwörter**: Verwenden Sie sichere SMTP-Passwörter
|
|
||||||
3. **SSL/TLS**: Verwenden Sie immer verschlüsselte Verbindungen
|
|
||||||
4. **DNS**: Konfigurieren Sie SPF, DMARC und DKIM
|
|
||||||
5. **Backups**: Sichern Sie die Konfigurationsdateien
|
|
||||||
|
|
||||||
## 📞 Support
|
|
||||||
|
|
||||||
Bei Problemen:
|
|
||||||
1. Prüfen Sie die Log-Dateien
|
|
||||||
2. Aktivieren Sie den Debug-Modus
|
|
||||||
3. Testen Sie die SMTP-Verbindung
|
|
||||||
4. Kontaktieren Sie Ihren Hosting-Provider
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**© 2024 HexaHost.de - Alle Rechte vorbehalten**
|
|
||||||
=======
|
|
||||||
├── config/
|
|
||||||
│ └── mail-config.php # SMTP-Konfiguration
|
|
||||||
├── vendor/ # Composer-Abhängigkeiten
|
|
||||||
├── logs/ # E-Mail-Logs
|
|
||||||
└── composer.json # Composer-Konfiguration
|
|
||||||
```
|
|
||||||
|
|
||||||
## Sicherheitshinweise
|
|
||||||
|
|
||||||
1. **SMTP-Passwort schützen**
|
|
||||||
- Datei `config/mail-config.php` nicht öffentlich zugänglich machen
|
|
||||||
- Passwort regelmäßig ändern
|
|
||||||
|
|
||||||
2. **HTTPS verwenden**
|
|
||||||
- Kontaktformular nur über HTTPS bereitstellen
|
|
||||||
- SSL-Zertifikat installieren
|
|
||||||
|
|
||||||
3. **Backup erstellen**
|
|
||||||
- Regelmäßige Backups der Konfiguration
|
|
||||||
- E-Mail-Logs sichern
|
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
Bei Problemen:
|
Bei Problemen:
|
||||||
1. Debug-Modus aktivieren
|
- Überprüfen Sie die PHP-Error-Logs
|
||||||
2. E-Mail-Logs prüfen
|
- Testen Sie mit `test-email.php`
|
||||||
3. SMTP-Einstellungen testen
|
- Kontaktieren Sie Ihren Hosting-Provider
|
||||||
4. Firewall-Einstellungen überprüfen
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
- **v1.0**: Vollständige E-Mail-Implementierung
|
|
||||||
- Anti-Spam-Headers
|
|
||||||
- Rate-Limiting
|
|
||||||
- CSRF-Schutz
|
|
||||||
- HTML-Templates
|
|
||||||
- Logging-System
|
|
||||||
>>>>>>> 04d4c58eb4d5f176a9f19520e2976037b9466326
|
|
||||||
|
|||||||
@@ -89,7 +89,6 @@
|
|||||||
} else {
|
} else {
|
||||||
// Show error message
|
// Show error message
|
||||||
showNotification(data.message, 'error');
|
showNotification(data.message, 'error');
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
// Highlight missing fields if provided
|
// Highlight missing fields if provided
|
||||||
if (data.missing_fields) {
|
if (data.missing_fields) {
|
||||||
@@ -103,20 +102,11 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
=======
|
|
||||||
>>>>>>> 04d4c58eb4d5f176a9f19520e2976037b9466326
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error('Error:', error);
|
console.error('Error:', error);
|
||||||
<<<<<<< HEAD
|
|
||||||
showNotification('Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.', 'error');
|
showNotification('Ein Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.', 'error');
|
||||||
=======
|
|
||||||
showNotification('Es gab ein Problem beim Senden Ihrer Nachricht. Bitte versuchen Sie es später erneut.', 'error');
|
|
||||||
>>>>>>> 04d4c58eb4d5f176a9f19520e2976037b9466326
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
// Reset button
|
|
||||||
submitBtn.textContent = originalText;
|
submitBtn.textContent = originalText;
|
||||||
submitBtn.disabled = false;
|
submitBtn.disabled = false;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -35,14 +35,14 @@
|
|||||||
// SMTP Konfiguration - HIER IHRE WERTE EINTRAGEN
|
// SMTP Konfiguration - HIER IHRE WERTE EINTRAGEN
|
||||||
$smtp_config = [
|
$smtp_config = [
|
||||||
// SMTP Server-Einstellungen
|
// SMTP Server-Einstellungen
|
||||||
'smtp_host' => 'YOUR_SMTP_HOST', // z.B. smtp.gmail.com
|
'smtp_host' => 'smtp.gmail.com', // z.B. smtp.gmail.com
|
||||||
'smtp_port' => 587, // 587 für TLS, 465 für SSL
|
'smtp_port' => 587, // 587 für TLS, 465 für SSL
|
||||||
'smtp_username' => 'YOUR_SMTP_USERNAME', // z.B. info@hexahost.de
|
'smtp_username' => 'test@hexahost.de', // z.B. info@hexahost.de
|
||||||
'smtp_password' => 'YOUR_SMTP_PASSWORD', // Ihr SMTP-Passwort
|
'smtp_password' => 'your-app-password', // Ihr SMTP-Passwort
|
||||||
'smtp_encryption' => 'tls', // 'tls' oder 'ssl'
|
'smtp_encryption' => 'tls', // 'tls' oder 'ssl'
|
||||||
|
|
||||||
// Absender-Einstellungen
|
// Absender-Einstellungen
|
||||||
'from_email' => 'info@hexahost.de', // Absender-E-Mail
|
'from_email' => 'test@hexahost.de', // Absender-E-Mail
|
||||||
'from_name' => 'HexaHost.de Kontaktformular', // Absender-Name
|
'from_name' => 'HexaHost.de Kontaktformular', // Absender-Name
|
||||||
|
|
||||||
// Empfänger-Einstellungen
|
// Empfänger-Einstellungen
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* HexaHost.de Contact Form Handler
|
* HexaHost.de Contact Form Handler
|
||||||
<<<<<<< HEAD
|
|
||||||
* E-Mail-Verarbeitung mit SMTP-Integration und Spam-Schutz
|
* E-Mail-Verarbeitung mit SMTP-Integration und Spam-Schutz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -198,7 +197,7 @@ function generateEmailHTML($data) {
|
|||||||
|
|
||||||
$subject_text = isset($subject_map[$data['subject']]) ? $subject_map[$data['subject']] : 'Neue Kontaktanfrage';
|
$subject_text = isset($subject_map[$data['subject']]) ? $subject_map[$data['subject']] : 'Neue Kontaktanfrage';
|
||||||
|
|
||||||
return '
|
$html = '
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
@@ -262,11 +261,6 @@ function generateEmailHTML($data) {
|
|||||||
<div class="message">' . nl2br($data['message']) . '</div>
|
<div class="message">' . nl2br($data['message']) . '</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
|
||||||
<div class="label">Newsletter-Anmeldung:</div>
|
|
||||||
<div class="value">' . (!empty($data['newsletter']) ? 'Ja' : 'Nein') . '</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="label">IP-Adresse:</div>
|
<div class="label">IP-Adresse:</div>
|
||||||
<div class="value">' . $_SERVER['REMOTE_ADDR'] . '</div>
|
<div class="value">' . $_SERVER['REMOTE_ADDR'] . '</div>
|
||||||
@@ -323,7 +317,6 @@ function generateEmailText($data) {
|
|||||||
$text .= "----------\n";
|
$text .= "----------\n";
|
||||||
$text .= $data['message'] . "\n\n";
|
$text .= $data['message'] . "\n\n";
|
||||||
|
|
||||||
$text .= "Newsletter-Anmeldung: " . (!empty($data['newsletter']) ? "Ja" : "Nein") . "\n";
|
|
||||||
$text .= "IP-Adresse: " . $_SERVER['REMOTE_ADDR'] . "\n";
|
$text .= "IP-Adresse: " . $_SERVER['REMOTE_ADDR'] . "\n";
|
||||||
$text .= "Zeitstempel: " . date('d.m.Y H:i:s') . "\n\n";
|
$text .= "Zeitstempel: " . date('d.m.Y H:i:s') . "\n\n";
|
||||||
|
|
||||||
@@ -396,7 +389,6 @@ try {
|
|||||||
'company' => sanitizeInput($_POST['company'] ?? ''),
|
'company' => sanitizeInput($_POST['company'] ?? ''),
|
||||||
'subject' => sanitizeInput($_POST['subject']),
|
'subject' => sanitizeInput($_POST['subject']),
|
||||||
'message' => sanitizeInput($_POST['message']),
|
'message' => sanitizeInput($_POST['message']),
|
||||||
'newsletter' => isset($_POST['newsletter']) ? true : false,
|
|
||||||
'privacy' => isset($_POST['privacy']) ? true : false
|
'privacy' => isset($_POST['privacy']) ? true : false
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -420,332 +412,6 @@ try {
|
|||||||
echo json_encode([
|
echo json_encode([
|
||||||
'success' => false,
|
'success' => false,
|
||||||
'message' => 'Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.'
|
'message' => 'Ein unerwarteter Fehler ist aufgetreten. Bitte versuchen Sie es später erneut.'
|
||||||
=======
|
|
||||||
* Handles contact form submissions and sends emails with proper anti-spam headers
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Prevent direct access
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|
||||||
http_response_code(405);
|
|
||||||
exit('Method not allowed');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load configuration
|
|
||||||
require_once 'config/mail-config.php';
|
|
||||||
|
|
||||||
// Set headers for AJAX response
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
header('X-Content-Type-Options: nosniff');
|
|
||||||
header('X-Frame-Options: DENY');
|
|
||||||
header('X-XSS-Protection: 1; mode=block');
|
|
||||||
|
|
||||||
// CSRF Protection
|
|
||||||
if (!isset($_POST['csrf_token']) || $_POST['csrf_token'] !== $_SESSION['csrf_token']) {
|
|
||||||
http_response_code(403);
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Security token invalid']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rate limiting
|
|
||||||
session_start();
|
|
||||||
$timeWindow = 300; // 5 minutes
|
|
||||||
$maxRequests = 3;
|
|
||||||
|
|
||||||
if (!isset($_SESSION['contact_attempts'])) {
|
|
||||||
$_SESSION['contact_attempts'] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean old attempts
|
|
||||||
$_SESSION['contact_attempts'] = array_filter($_SESSION['contact_attempts'], function($timestamp) use ($timeWindow) {
|
|
||||||
return $timestamp > (time() - $timeWindow);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (count($_SESSION['contact_attempts']) >= $maxRequests) {
|
|
||||||
http_response_code(429);
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Zu viele Anfragen. Bitte warten Sie 5 Minuten.']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add current attempt
|
|
||||||
$_SESSION['contact_attempts'][] = time();
|
|
||||||
|
|
||||||
// Validate required fields
|
|
||||||
$requiredFields = ['firstName', 'lastName', 'email', 'subject', 'message', 'privacy'];
|
|
||||||
$errors = [];
|
|
||||||
|
|
||||||
foreach ($requiredFields as $field) {
|
|
||||||
if (!isset($_POST[$field]) || trim($_POST[$field]) === '') {
|
|
||||||
$errors[] = "Das Feld '$field' ist erforderlich.";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate email
|
|
||||||
if (isset($_POST['email']) && !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
|
|
||||||
$errors[] = 'Bitte geben Sie eine gültige E-Mail-Adresse ein.';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate privacy checkbox
|
|
||||||
if (!isset($_POST['privacy']) || $_POST['privacy'] !== 'on') {
|
|
||||||
$errors[] = 'Sie müssen der Datenschutzerklärung zustimmen.';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for spam indicators
|
|
||||||
$spamScore = 0;
|
|
||||||
$message = isset($_POST['message']) ? $_POST['message'] : '';
|
|
||||||
|
|
||||||
// Check message length
|
|
||||||
if (strlen($message) < 10) {
|
|
||||||
$spamScore += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($message) > 5000) {
|
|
||||||
$spamScore += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for suspicious patterns
|
|
||||||
$suspiciousPatterns = [
|
|
||||||
'/\b(viagra|casino|loan|credit|debt)\b/i',
|
|
||||||
'/\b(click here|buy now|free money)\b/i',
|
|
||||||
'/\b(www\.|http:\/\/|https:\/\/)/i',
|
|
||||||
'/\b[A-Z]{5,}/', // ALL CAPS
|
|
||||||
'/\b\d{10,}/', // Too many numbers
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($suspiciousPatterns as $pattern) {
|
|
||||||
if (preg_match($pattern, $message)) {
|
|
||||||
$spamScore += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for too many links
|
|
||||||
$linkCount = preg_match_all('/https?:\/\/[^\s]+/', $message);
|
|
||||||
if ($linkCount > 2) {
|
|
||||||
$spamScore += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reject if spam score is too high
|
|
||||||
if ($spamScore >= 5) {
|
|
||||||
http_response_code(400);
|
|
||||||
echo json_encode(['success' => false, 'message' => 'Ihre Nachricht wurde als Spam erkannt.']);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($errors)) {
|
|
||||||
http_response_code(400);
|
|
||||||
echo json_encode(['success' => false, 'message' => implode(' ', $errors)]);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sanitize input
|
|
||||||
$firstName = htmlspecialchars(trim($_POST['firstName']), ENT_QUOTES, 'UTF-8');
|
|
||||||
$lastName = htmlspecialchars(trim($_POST['lastName']), ENT_QUOTES, 'UTF-8');
|
|
||||||
$email = filter_var(trim($_POST['email']), FILTER_SANITIZE_EMAIL);
|
|
||||||
$phone = isset($_POST['phone']) ? htmlspecialchars(trim($_POST['phone']), ENT_QUOTES, 'UTF-8') : '';
|
|
||||||
$company = isset($_POST['company']) ? htmlspecialchars(trim($_POST['company']), ENT_QUOTES, 'UTF-8') : '';
|
|
||||||
$subject = htmlspecialchars(trim($_POST['subject']), ENT_QUOTES, 'UTF-8');
|
|
||||||
$message = htmlspecialchars(trim($_POST['message']), ENT_QUOTES, 'UTF-8');
|
|
||||||
$newsletter = isset($_POST['newsletter']) && $_POST['newsletter'] === 'on';
|
|
||||||
|
|
||||||
// Map subject to readable text
|
|
||||||
$subjectMap = [
|
|
||||||
'allgemeine-anfrage' => 'Allgemeine Anfrage',
|
|
||||||
'vpc-anfrage' => 'Virtual Private Container Anfrage',
|
|
||||||
'vps-anfrage' => 'Virtual Private Server Anfrage',
|
|
||||||
'mail-gateway-anfrage' => 'Mail Gateway Anfrage',
|
|
||||||
'webhosting-anfrage' => 'Webhosting Anfrage',
|
|
||||||
'support' => 'Technischer Support',
|
|
||||||
'beratung' => 'Persönliche Beratung',
|
|
||||||
'migration' => 'Migration/Umzug',
|
|
||||||
'sonstiges' => 'Sonstiges'
|
|
||||||
];
|
|
||||||
|
|
||||||
$subjectText = isset($subjectMap[$subject]) ? $subjectMap[$subject] : $subject;
|
|
||||||
|
|
||||||
// Prepare email content
|
|
||||||
$emailSubject = "Neue Kontaktanfrage: $subjectText - HexaHost.de";
|
|
||||||
$emailBody = "Eine neue Kontaktanfrage wurde über das Kontaktformular eingegangen:\n\n";
|
|
||||||
$emailBody .= "Name: $firstName $lastName\n";
|
|
||||||
$emailBody .= "E-Mail: $email\n";
|
|
||||||
if ($phone) $emailBody .= "Telefon: $phone\n";
|
|
||||||
if ($company) $emailBody .= "Unternehmen: $company\n";
|
|
||||||
$emailBody .= "Betreff: $subjectText\n";
|
|
||||||
$emailBody .= "Newsletter-Anmeldung: " . ($newsletter ? 'Ja' : 'Nein') . "\n\n";
|
|
||||||
$emailBody .= "Nachricht:\n$message\n\n";
|
|
||||||
$emailBody .= "---\n";
|
|
||||||
$emailBody .= "Diese E-Mail wurde automatisch generiert von hexahost.de\n";
|
|
||||||
$emailBody .= "IP-Adresse: " . $_SERVER['REMOTE_ADDR'] . "\n";
|
|
||||||
$emailBody .= "Zeitstempel: " . date('Y-m-d H:i:s') . "\n";
|
|
||||||
|
|
||||||
// Prepare HTML version
|
|
||||||
$htmlBody = "
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang='de'>
|
|
||||||
<head>
|
|
||||||
<meta charset='UTF-8'>
|
|
||||||
<title>Neue Kontaktanfrage - HexaHost.de</title>
|
|
||||||
<style>
|
|
||||||
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
|
|
||||||
.header { background: #ff51f9; color: white; padding: 20px; text-align: center; }
|
|
||||||
.content { padding: 20px; }
|
|
||||||
.field { margin-bottom: 15px; }
|
|
||||||
.label { font-weight: bold; }
|
|
||||||
.message { background: #f5f5f5; padding: 15px; border-left: 4px solid #ff51f9; }
|
|
||||||
.footer { background: #f5f5f5; padding: 15px; font-size: 12px; color: #666; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class='header'>
|
|
||||||
<h1>Neue Kontaktanfrage - HexaHost.de</h1>
|
|
||||||
</div>
|
|
||||||
<div class='content'>
|
|
||||||
<div class='field'>
|
|
||||||
<span class='label'>Name:</span> $firstName $lastName
|
|
||||||
</div>
|
|
||||||
<div class='field'>
|
|
||||||
<span class='label'>E-Mail:</span> $email
|
|
||||||
</div>";
|
|
||||||
|
|
||||||
if ($phone) {
|
|
||||||
$htmlBody .= "<div class='field'><span class='label'>Telefon:</span> $phone</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($company) {
|
|
||||||
$htmlBody .= "<div class='field'><span class='label'>Unternehmen:</span> $company</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$htmlBody .= "
|
|
||||||
<div class='field'>
|
|
||||||
<span class='label'>Betreff:</span> $subjectText
|
|
||||||
</div>
|
|
||||||
<div class='field'>
|
|
||||||
<span class='label'>Newsletter-Anmeldung:</span> " . ($newsletter ? 'Ja' : 'Nein') . "
|
|
||||||
</div>
|
|
||||||
<div class='field'>
|
|
||||||
<span class='label'>Nachricht:</span>
|
|
||||||
<div class='message'>" . nl2br($message) . "</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class='footer'>
|
|
||||||
<p>Diese E-Mail wurde automatisch generiert von hexahost.de</p>
|
|
||||||
<p>IP-Adresse: " . $_SERVER['REMOTE_ADDR'] . "</p>
|
|
||||||
<p>Zeitstempel: " . date('Y-m-d H:i:s') . "</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>";
|
|
||||||
|
|
||||||
// Send email using PHPMailer
|
|
||||||
try {
|
|
||||||
require_once 'vendor/autoload.php';
|
|
||||||
|
|
||||||
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
|
|
||||||
|
|
||||||
// Server settings
|
|
||||||
$mail->isSMTP();
|
|
||||||
$mail->Host = SMTP_HOST;
|
|
||||||
$mail->SMTPAuth = true;
|
|
||||||
$mail->Username = SMTP_USERNAME;
|
|
||||||
$mail->Password = SMTP_PASSWORD;
|
|
||||||
$mail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;
|
|
||||||
$mail->Port = SMTP_PORT;
|
|
||||||
$mail->CharSet = 'UTF-8';
|
|
||||||
|
|
||||||
// Anti-spam headers
|
|
||||||
$mail->addCustomHeader('X-Mailer', 'HexaHost.de Contact Form');
|
|
||||||
$mail->addCustomHeader('X-Priority', '3');
|
|
||||||
$mail->addCustomHeader('X-MSMail-Priority', 'Normal');
|
|
||||||
$mail->addCustomHeader('Importance', 'Normal');
|
|
||||||
$mail->addCustomHeader('X-Report-Abuse', 'Please report abuse here: abuse@hexahost.de');
|
|
||||||
$mail->addCustomHeader('List-Unsubscribe', '<mailto:unsubscribe@hexahost.de>');
|
|
||||||
$mail->addCustomHeader('Precedence', 'bulk');
|
|
||||||
|
|
||||||
// Recipients
|
|
||||||
$mail->setFrom(SMTP_FROM_EMAIL, 'HexaHost.de Kontaktformular');
|
|
||||||
$mail->addAddress(SMTP_TO_EMAIL, 'HexaHost Support');
|
|
||||||
$mail->addReplyTo($email, "$firstName $lastName");
|
|
||||||
|
|
||||||
// Content
|
|
||||||
$mail->isHTML(true);
|
|
||||||
$mail->Subject = $emailSubject;
|
|
||||||
$mail->Body = $htmlBody;
|
|
||||||
$mail->AltBody = $emailBody;
|
|
||||||
|
|
||||||
// Send email
|
|
||||||
$mail->send();
|
|
||||||
|
|
||||||
// Send confirmation to user
|
|
||||||
$userMail = new PHPMailer\PHPMailer\PHPMailer(true);
|
|
||||||
|
|
||||||
// Server settings
|
|
||||||
$userMail->isSMTP();
|
|
||||||
$userMail->Host = SMTP_HOST;
|
|
||||||
$userMail->SMTPAuth = true;
|
|
||||||
$userMail->Username = SMTP_USERNAME;
|
|
||||||
$userMail->Password = SMTP_PASSWORD;
|
|
||||||
$userMail->SMTPSecure = PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS;
|
|
||||||
$userMail->Port = SMTP_PORT;
|
|
||||||
$userMail->CharSet = 'UTF-8';
|
|
||||||
|
|
||||||
// Anti-spam headers for user confirmation
|
|
||||||
$userMail->addCustomHeader('X-Mailer', 'HexaHost.de Contact Form');
|
|
||||||
$userMail->addCustomHeader('X-Priority', '3');
|
|
||||||
$userMail->addCustomHeader('X-MSMail-Priority', 'Normal');
|
|
||||||
$userMail->addCustomHeader('Importance', 'Normal');
|
|
||||||
|
|
||||||
// Recipients
|
|
||||||
$userMail->setFrom(SMTP_FROM_EMAIL, 'HexaHost.de');
|
|
||||||
$userMail->addAddress($email, "$firstName $lastName");
|
|
||||||
|
|
||||||
// Content
|
|
||||||
$userMail->isHTML(true);
|
|
||||||
$userMail->Subject = 'Vielen Dank für Ihre Nachricht - HexaHost.de';
|
|
||||||
$userMail->Body = "
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang='de'>
|
|
||||||
<head>
|
|
||||||
<meta charset='UTF-8'>
|
|
||||||
<title>Vielen Dank - HexaHost.de</title>
|
|
||||||
<style>
|
|
||||||
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
|
|
||||||
.header { background: #ff51f9; color: white; padding: 20px; text-align: center; }
|
|
||||||
.content { padding: 20px; }
|
|
||||||
.footer { background: #f5f5f5; padding: 15px; font-size: 12px; color: #666; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class='header'>
|
|
||||||
<h1>Vielen Dank für Ihre Nachricht!</h1>
|
|
||||||
</div>
|
|
||||||
<div class='content'>
|
|
||||||
<p>Hallo $firstName,</p>
|
|
||||||
<p>vielen Dank für Ihre Nachricht an HexaHost.de. Wir haben Ihre Anfrage erhalten und werden uns schnellstmöglich bei Ihnen melden.</p>
|
|
||||||
<p><strong>Ihre Nachricht:</strong><br>" . nl2br($message) . "</p>
|
|
||||||
<p>Unser Support-Team bearbeitet Ihre Anfrage und antwortet in der Regel innerhalb von 2-4 Stunden.</p>
|
|
||||||
<p>Bei dringenden Anliegen erreichen Sie uns auch telefonisch unter +49 851 1999 9999.</p>
|
|
||||||
</div>
|
|
||||||
<div class='footer'>
|
|
||||||
<p>Mit freundlichen Grüßen<br>Ihr HexaHost.de Team</p>
|
|
||||||
<p>Niederbayern, Deutschland</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>";
|
|
||||||
|
|
||||||
$userMail->AltBody = "Vielen Dank für Ihre Nachricht an HexaHost.de. Wir haben Ihre Anfrage erhalten und werden uns schnellstmöglich bei Ihnen melden.";
|
|
||||||
|
|
||||||
$userMail->send();
|
|
||||||
|
|
||||||
// Success response
|
|
||||||
echo json_encode([
|
|
||||||
'success' => true,
|
|
||||||
'message' => 'Ihre Nachricht wurde erfolgreich gesendet! Sie erhalten in Kürze eine Bestätigung per E-Mail.'
|
|
||||||
]);
|
|
||||||
|
|
||||||
} catch (Exception $e) {
|
|
||||||
error_log("Mail error: " . $e->getMessage());
|
|
||||||
http_response_code(500);
|
|
||||||
echo json_encode([
|
|
||||||
'success' => false,
|
|
||||||
'message' => 'Es gab ein Problem beim Senden Ihrer Nachricht. Bitte versuchen Sie es später erneut oder kontaktieren Sie uns direkt.'
|
|
||||||
>>>>>>> 04d4c58eb4d5f176a9f19520e2976037b9466326
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<form class="contact-form glass-card" id="contactForm" action="contact-handler.php" method="POST">
|
<form class="contact-form glass-card" id="contactForm" action="contact-handler.php" method="POST">
|
||||||
<input type="hidden" name="csrf_token" value="<?php echo generateCSRFToken(); ?>">
|
<input type="hidden" name="website" value="">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="firstName">Vorname *</label>
|
<label for="firstName">Vorname *</label>
|
||||||
|
|||||||
72
public/test-email.php
Normal file
72
public/test-email.php
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* HexaHost.de E-Mail Test
|
||||||
|
* Testet die E-Mail-Funktionalität ohne PHPMailer
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Konfiguration laden
|
||||||
|
require_once 'config.php';
|
||||||
|
|
||||||
|
// Test-E-Mail senden
|
||||||
|
function testEmail() {
|
||||||
|
$config = getHexaHostConfig();
|
||||||
|
|
||||||
|
// Test-Daten
|
||||||
|
$test_data = [
|
||||||
|
'firstName' => 'Test',
|
||||||
|
'lastName' => 'Benutzer',
|
||||||
|
'email' => 'test@example.com',
|
||||||
|
'phone' => '+49 123 456789',
|
||||||
|
'company' => 'Test GmbH',
|
||||||
|
'subject' => 'test-email',
|
||||||
|
'message' => 'Dies ist eine Test-E-Mail vom HexaHost.de Kontaktformular.'
|
||||||
|
];
|
||||||
|
|
||||||
|
// E-Mail-Inhalt erstellen
|
||||||
|
$subject = '[HexaHost.de] Test-E-Mail';
|
||||||
|
$message = "Test-E-Mail von HexaHost.de\n\n";
|
||||||
|
$message .= "Name: " . $test_data['firstName'] . " " . $test_data['lastName'] . "\n";
|
||||||
|
$message .= "E-Mail: " . $test_data['email'] . "\n";
|
||||||
|
$message .= "Telefon: " . $test_data['phone'] . "\n";
|
||||||
|
$message .= "Unternehmen: " . $test_data['company'] . "\n";
|
||||||
|
$message .= "Nachricht: " . $test_data['message'] . "\n\n";
|
||||||
|
$message .= "Zeitstempel: " . date('d.m.Y H:i:s') . "\n";
|
||||||
|
$message .= "IP-Adresse: " . $_SERVER['REMOTE_ADDR'] . "\n";
|
||||||
|
|
||||||
|
// Headers
|
||||||
|
$headers = [
|
||||||
|
'From: ' . $config['from_name'] . ' <' . $config['from_email'] . '>',
|
||||||
|
'Reply-To: ' . $test_data['firstName'] . ' ' . $test_data['lastName'] . ' <' . $test_data['email'] . '>',
|
||||||
|
'MIME-Version: 1.0',
|
||||||
|
'Content-Type: text/plain; charset=UTF-8',
|
||||||
|
'X-Mailer: HexaHost Test Email'
|
||||||
|
];
|
||||||
|
|
||||||
|
// E-Mail senden
|
||||||
|
$result = mail($config['to_email'], $subject, $message, implode("\r\n", $headers));
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test ausführen
|
||||||
|
if (isset($_GET['test'])) {
|
||||||
|
$result = testEmail();
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
echo "✅ Test-E-Mail wurde erfolgreich gesendet!";
|
||||||
|
} else {
|
||||||
|
echo "❌ Fehler beim Senden der Test-E-Mail.";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "<h1>HexaHost.de E-Mail Test</h1>";
|
||||||
|
echo "<p>Klicken Sie auf den Link, um eine Test-E-Mail zu senden:</p>";
|
||||||
|
echo "<a href='?test=1'>Test-E-Mail senden</a>";
|
||||||
|
|
||||||
|
// Konfiguration anzeigen
|
||||||
|
echo "<h2>Aktuelle Konfiguration:</h2>";
|
||||||
|
$config = getHexaHostConfig();
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($config);
|
||||||
|
echo "</pre>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user