mirror of
https://git.hexahost.dev/smueller/HexaHost-Frontend.git
synced 2026-06-02 07:18:42 +00:00
Refactor email handling in contact form: Transitioned from PHPMailer to native PHP mail() function, removing Composer dependencies. Updated documentation to reflect changes in email configuration and setup. Enhanced security features including CSRF protection and input validation. Adjusted product pricing and specifications in backend configuration files.
This commit is contained in:
@@ -2,172 +2,54 @@
|
||||
|
||||
## Übersicht
|
||||
|
||||
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.
|
||||
Das Kontaktformular nutzt den nativen PHP-Mailversand über `mail()`.
|
||||
Es wird keine zusätzliche Bibliothek und keine Composer-Installation benötigt.
|
||||
|
||||
## Aktuelle Probleme
|
||||
## Erforderliche Konfiguration
|
||||
|
||||
### 1. ✅ Behoben: Merge-Konflikt in contact-handler.php
|
||||
- Der Git-Merge-Konflikt wurde aufgelöst
|
||||
- Die Datei ist jetzt funktionsfähig
|
||||
Datei: `backend/config/mail-config.php`
|
||||
|
||||
### 2. ⚠️ Zu beheben: SMTP-Konfiguration
|
||||
- Die SMTP-Einstellungen sind noch auf Testwerte gesetzt
|
||||
- Sie müssen mit echten SMTP-Daten konfiguriert werden
|
||||
Mindestens diese Werte müssen korrekt gesetzt sein:
|
||||
|
||||
### 3. ⚠️ Zu beheben: PHPMailer-Installation
|
||||
- Composer ist nicht installiert
|
||||
- PHPMailer ist nicht verfügbar
|
||||
- Fallback auf native PHP mail() Funktion ist aktiv
|
||||
|
||||
## SMTP-Konfiguration
|
||||
|
||||
### 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
|
||||
'smtp_host' => 'smtp.gmail.com',
|
||||
'smtp_port' => 587,
|
||||
'smtp_username' => 'ihre-email@gmail.com',
|
||||
'smtp_password' => 'ihr-app-passwort',
|
||||
'smtp_encryption' => 'tls',
|
||||
'from_email' => 'ihre-email@gmail.com',
|
||||
'to_email' => 'info@hexahost.de',
|
||||
define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de');
|
||||
define('SMTP_TO_EMAIL', 'info@hexahost.de');
|
||||
```
|
||||
|
||||
### Option 2: Eigener Mail-Server
|
||||
## Voraussetzungen auf dem 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',
|
||||
```
|
||||
- `mail()` muss in der PHP-Umgebung aktiviert sein
|
||||
- Ein Mail Transfer Agent (MTA) bzw. Mailversand beim Hoster muss funktionieren
|
||||
|
||||
### Option 3: Andere E-Mail-Provider
|
||||
## Test der E-Mail-Funktion
|
||||
|
||||
#### Outlook/Hotmail:
|
||||
```php
|
||||
'smtp_host' => 'smtp-mail.outlook.com',
|
||||
'smtp_port' => 587,
|
||||
'smtp_encryption' => 'tls',
|
||||
```
|
||||
|
||||
#### GMX:
|
||||
```php
|
||||
'smtp_host' => 'mail.gmx.net',
|
||||
'smtp_port' => 587,
|
||||
'smtp_encryption' => 'tls',
|
||||
```
|
||||
|
||||
#### Web.de:
|
||||
```php
|
||||
'smtp_host' => 'smtp.web.de',
|
||||
'smtp_port' => 587,
|
||||
'smtp_encryption' => 'tls',
|
||||
```
|
||||
|
||||
## PHPMailer-Installation
|
||||
|
||||
### Composer installieren:
|
||||
|
||||
1. **Windows:**
|
||||
- Laden Sie Composer von https://getcomposer.org/download/
|
||||
- Führen Sie den Installer aus
|
||||
|
||||
2. **Linux/macOS:**
|
||||
```bash
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
sudo mv composer.phar /usr/local/bin/composer
|
||||
```
|
||||
|
||||
### PHPMailer installieren:
|
||||
|
||||
```bash
|
||||
cd public
|
||||
composer install
|
||||
```
|
||||
|
||||
## Test der E-Mail-Funktionalität
|
||||
|
||||
### 1. Test-Datei verwenden:
|
||||
- Öffnen Sie `test-email.php` im Browser
|
||||
- Klicken Sie auf "Test-E-Mail senden"
|
||||
|
||||
### 2. Kontaktformular testen:
|
||||
- Öffnen Sie `contact.html`
|
||||
- Füllen Sie das Formular aus
|
||||
- Überprüfen Sie die Antwort
|
||||
|
||||
## Sicherheitseinstellungen
|
||||
|
||||
### DNS-Einträge für Spam-Schutz:
|
||||
|
||||
1. **SPF Record (TXT):**
|
||||
```
|
||||
v=spf1 include:_spf.hexahost.de ~all
|
||||
```
|
||||
|
||||
2. **DMARC Record (TXT):**
|
||||
```
|
||||
v=DMARC1; p=quarantine; rua=mailto:dmarc@hexahost.de
|
||||
```
|
||||
|
||||
3. **DKIM (wird vom Mail-Server konfiguriert)**
|
||||
1. Per Script testen:
|
||||
- `scripts/test-email.php`
|
||||
2. Kontaktformular testen:
|
||||
- Seite `contact.php` öffnen
|
||||
- Formular absenden
|
||||
- Empfang im Zielpostfach prüfen
|
||||
|
||||
## Fehlerbehebung
|
||||
|
||||
### Häufige Probleme:
|
||||
### Meldung: "Mail function not available"
|
||||
- `mail()` ist auf dem Server deaktiviert
|
||||
- Hoster kontaktieren und Mailfunktion aktivieren lassen
|
||||
|
||||
1. **"SMTP connect() failed"**
|
||||
- Überprüfen Sie Host und Port
|
||||
- Prüfen Sie Firewall-Einstellungen
|
||||
### Nachricht kommt nicht an
|
||||
- Spam-Ordner prüfen
|
||||
- Absenderadresse (`SMTP_FROM_EMAIL`) auf gültige Domain setzen
|
||||
- PHP-Error-Log prüfen
|
||||
|
||||
2. **"Authentication failed"**
|
||||
- Überprüfen Sie Benutzername und Passwort
|
||||
- Bei Gmail: App-Passwort verwenden
|
||||
### Versand funktioniert lokal nicht
|
||||
- Unter Windows/Lokalumgebung ist oft kein SMTP in `php.ini` konfiguriert
|
||||
- Auf dem echten Webserver testen
|
||||
|
||||
3. **"Connection timeout"**
|
||||
- Prüfen Sie Internetverbindung
|
||||
- Überprüfen Sie SMTP-Host
|
||||
## Sicherheit
|
||||
|
||||
4. **"Mail function not available"**
|
||||
- PHP mail() Funktion ist deaktiviert
|
||||
- Kontaktieren Sie Ihren Hosting-Provider
|
||||
Das Kontaktformular beinhaltet bereits:
|
||||
- CSRF-Schutz
|
||||
- Rate Limiting
|
||||
- Honeypot-Feld
|
||||
- Serverseitige Validierung und Sanitization
|
||||
|
||||
## Debug-Modus aktivieren
|
||||
|
||||
In `config.php` setzen Sie:
|
||||
```php
|
||||
'debug_mode' => true,
|
||||
```
|
||||
|
||||
## Logs überprüfen
|
||||
|
||||
E-Mail-Fehler werden in den PHP-Error-Logs gespeichert:
|
||||
- Windows: Event Viewer
|
||||
- Linux: `/var/log/php_errors.log`
|
||||
|
||||
## Nächste Schritte
|
||||
|
||||
1. ✅ Merge-Konflikt behoben
|
||||
2. ⚠️ SMTP-Konfiguration anpassen
|
||||
3. ⚠️ PHPMailer installieren (optional)
|
||||
4. ⚠️ E-Mail-Funktionalität testen
|
||||
5. ⚠️ DNS-Einträge für Spam-Schutz konfigurieren
|
||||
|
||||
## Support
|
||||
|
||||
Bei Problemen:
|
||||
- Überprüfen Sie die PHP-Error-Logs
|
||||
- Testen Sie mit `test-email.php`
|
||||
- Kontaktieren Sie Ihren Hosting-Provider
|
||||
|
||||
Reference in New Issue
Block a user