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:
smueller
2026-05-27 13:04:52 +02:00
parent d44aaa197b
commit 67fbc68d45
9 changed files with 125 additions and 489 deletions

View File

@@ -46,7 +46,7 @@ Eine moderne und umfangreiche Website für das Hosting-Unternehmen HexaHost.de a
- **HTML5** - Semantisches Markup - **HTML5** - Semantisches Markup
- **CSS3** - Moderne Styles mit Custom Properties - **CSS3** - Moderne Styles mit Custom Properties
- **Vanilla JavaScript** - Keine Framework-Dependencies - **Vanilla JavaScript** - Keine Framework-Dependencies
- **PHPMailer** - E-Mail-Versand via SMTP - **Native PHP mail()** - E-Mail-Versand ohne externe Abhängigkeiten
- **Glassmorphism Design** - Moderne Glaseffekte - **Glassmorphism Design** - Moderne Glaseffekte
- **CSS Grid & Flexbox** - Responsive Layouts - **CSS Grid & Flexbox** - Responsive Layouts
- **Inter Font** - Moderne Typografie - **Inter Font** - Moderne Typografie
@@ -73,7 +73,6 @@ HexaHost-Frontend/
│ ├── sitemap.xml # SEO Sitemap │ ├── sitemap.xml # SEO Sitemap
│ ├── favicon.svg # Website Icon │ ├── favicon.svg # Website Icon
│ ├── .htaccess # Apache Konfiguration │ ├── .htaccess # Apache Konfiguration
│ ├── composer.json # PHP Dependencies
│ ├── config/ # ⬅ vom Backend │ ├── config/ # ⬅ vom Backend
│ │ ├── config.php # Allgemeine Konfiguration │ │ ├── config.php # Allgemeine Konfiguration
│ │ └── mail-config.php # E-Mail-Konfiguration │ │ └── mail-config.php # E-Mail-Konfiguration
@@ -127,7 +126,6 @@ HexaHost-Frontend/
### Voraussetzungen ### Voraussetzungen
- PHP 8.0 oder höher - PHP 8.0 oder höher
- Composer (für PHPMailer)
- Apache mit mod_rewrite (für .htaccess) - Apache mit mod_rewrite (für .htaccess)
- [HexaHost-Backend](../HexaHost-Backend) Repository - [HexaHost-Backend](../HexaHost-Backend) Repository
@@ -147,24 +145,18 @@ HexaHost-Frontend/
cp -r HexaHost-Backend/includes/* HexaHost-Frontend/public/includes/ cp -r HexaHost-Backend/includes/* HexaHost-Frontend/public/includes/
``` ```
3. **PHP Dependencies installieren** 3. **Konfiguration anpassen**
```bash
cd HexaHost-Frontend/public
composer install
```
4. **Konfiguration anpassen**
```bash ```bash
# mail-config.php mit SMTP-Daten bearbeiten # mail-config.php mit SMTP-Daten bearbeiten
nano config/mail-config.php nano config/mail-config.php
``` ```
5. **Lokaler Development Server** 4. **Lokaler Development Server**
```bash ```bash
php -S localhost:8000 -t public php -S localhost:8000 -t public
``` ```
6. **Website öffnen** 5. **Website öffnen**
``` ```
http://localhost:8000 http://localhost:8000
``` ```
@@ -208,13 +200,11 @@ Detaillierte Informationen zu den Backend-Komponenten finden Sie in der [Backend
## 📧 E-Mail-Konfiguration ## 📧 E-Mail-Konfiguration
Die E-Mail-Funktionalität benötigt eine SMTP-Konfiguration in `public/config/mail-config.php`: Die E-Mail-Funktionalität nutzt die native PHP-`mail()`-Funktion. In `public/config/mail-config.php` müssen mindestens Absender und Empfänger gesetzt werden:
```php ```php
define('SMTP_HOST', 'mail.example.com'); define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de');
define('SMTP_PORT', 587); define('SMTP_TO_EMAIL', 'info@hexahost.de');
define('SMTP_USER', 'noreply@hexahost.de');
define('SMTP_PASS', 'your-password');
``` ```
Siehe `docs/README-EMAIL-SETUP.md` für detaillierte Anweisungen. Siehe `docs/README-EMAIL-SETUP.md` für detaillierte Anweisungen.
@@ -241,7 +231,7 @@ Siehe `docs/README-EMAIL-SETUP.md` für detaillierte Anweisungen.
### Kontaktformular ### Kontaktformular
- Server-seitige Validierung - Server-seitige Validierung
- E-Mail-Versand via SMTP - E-Mail-Versand via native PHP mail()
- CSRF-Schutz - CSRF-Schutz
- Auto-Fill basierend auf URL-Parametern - Auto-Fill basierend auf URL-Parametern
- FAQ-Sektion mit Accordion - FAQ-Sektion mit Accordion

View File

@@ -1,50 +1,13 @@
<?php <?php
/** /**
* HexaHost.de Mail Configuration * HexaHost.de Mail Configuration
* *
* Bitte passen Sie die folgenden SMTP-Einstellungen an Ihre E-Mail-Provider an. * Dieses Projekt versendet E-Mails nativ über PHP mail().
* * Es sind keine externen Bibliotheken oder Composer-Installationen erforderlich.
* Beispiele für gängige Provider:
*
* Gmail:
* - SMTP_HOST = 'smtp.gmail.com'
* - SMTP_PORT = 587
* - SMTP_USERNAME = 'ihre-email@gmail.com'
* - SMTP_PASSWORD = 'ihr-app-passwort'
*
* Outlook/Hotmail:
* - SMTP_HOST = 'smtp-mail.outlook.com'
* - SMTP_PORT = 587
*
* GMX:
* - SMTP_HOST = 'mail.gmx.net'
* - SMTP_PORT = 587
*
* Web.de:
* - SMTP_HOST = 'smtp.web.de'
* - SMTP_PORT = 587
*
* 1&1:
* - SMTP_HOST = 'smtp.1und1.de'
* - SMTP_PORT = 587
*
* Strato:
* - SMTP_HOST = 'smtp.strato.de'
* - SMTP_PORT = 587
*
* Ionos:
* - SMTP_HOST = 'smtp.ionos.de'
* - SMTP_PORT = 587
*/ */
// SMTP Server Einstellungen
define('SMTP_HOST', 'smtp.ihre-domain.de'); // Ihr SMTP-Server
define('SMTP_PORT', 587); // SMTP-Port (meist 587 oder 465)
define('SMTP_USERNAME', 'kontakt@ihre-domain.de'); // Ihr SMTP-Benutzername
define('SMTP_PASSWORD', 'ihr-smtp-passwort'); // Ihr SMTP-Passwort
// E-Mail Adressen // E-Mail Adressen
define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de'); // Absender-E-Mail (muss zu SMTP_USERNAME passen) define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de'); // Absender-E-Mail
define('SMTP_TO_EMAIL', 'info@hexahost.de'); // Empfänger-E-Mail für Kontaktformular define('SMTP_TO_EMAIL', 'info@hexahost.de'); // Empfänger-E-Mail für Kontaktformular
// Sicherheitseinstellungen // Sicherheitseinstellungen
@@ -87,11 +50,6 @@ define('BLACKLISTED_EMAILS', [
// 'test@test.com' // 'test@test.com'
]); ]);
// Validierung der Konfiguration
if (!defined('SMTP_HOST') || !defined('SMTP_USERNAME') || !defined('SMTP_PASSWORD')) {
die('SMTP-Konfiguration ist unvollständig. Bitte überprüfen Sie die mail-config.php');
}
// Überprüfung der E-Mail-Adressen // Überprüfung der E-Mail-Adressen
if (!filter_var(SMTP_FROM_EMAIL, FILTER_VALIDATE_EMAIL)) { if (!filter_var(SMTP_FROM_EMAIL, FILTER_VALIDATE_EMAIL)) {
die('Ungültige SMTP_FROM_EMAIL Adresse'); die('Ungültige SMTP_FROM_EMAIL Adresse');
@@ -149,13 +107,6 @@ function isValidEmail($email) {
*/ */
function getHexaHostConfig($key = null) { function getHexaHostConfig($key = null) {
$config = [ $config = [
// SMTP Server-Einstellungen
'smtp_host' => SMTP_HOST,
'smtp_port' => SMTP_PORT,
'smtp_username' => SMTP_USERNAME,
'smtp_password' => SMTP_PASSWORD,
'smtp_encryption' => 'tls',
// Absender/Empfänger // Absender/Empfänger
'from_email' => SMTP_FROM_EMAIL, 'from_email' => SMTP_FROM_EMAIL,
'from_name' => 'HexaHost.de Kontaktformular', 'from_name' => 'HexaHost.de Kontaktformular',

View File

@@ -323,53 +323,58 @@ $PRODUCTS['webhosting'] = [
'name' => 'Webhosting', 'name' => 'Webhosting',
'short_name' => 'Webhosting', 'short_name' => 'Webhosting',
'description' => 'Klassisches Hosting mit PHP, MySQL und SSL', 'description' => 'Klassisches Hosting mit PHP, MySQL und SSL',
'min_price' => '1,99', 'min_price' => '4,99',
'hero_highlight' => 'Alles für Ihre Website', 'hero_highlight' => 'Alles für Ihre Website',
'hero_description' => 'Klassisches Webhosting mit allem, was Sie für eine erfolgreiche Website benötigen. PHP, MySQL, SSL-Zertifikate und E-Mail-Postfächer - alles inklusive.', 'hero_description' => 'Klassisches Webhosting mit allem, was Sie für eine erfolgreiche Website benötigen. Plesk, PHP, SSL-Zertifikate und E-Mail-Postfächer - alles inklusive.',
'packages_title' => 'Webhosting Pakete', 'packages_title' => 'Webhosting Pakete',
'packages_description' => 'Von der ersten Website bis zum professionellen Online-Shop', 'packages_description' => 'Von der ersten Website bis zum professionellen Online-Shop',
'cta_title' => 'Bereit für Ihr Webhosting?', 'cta_title' => 'Bereit für Ihr Webhosting?',
'cta_description' => 'Starten Sie noch heute mit professionellem Webhosting', 'cta_description' => 'Starten Sie noch heute mit professionellem Webhosting',
'page_title' => 'Webhosting - Klassisches Hosting für Websites | HexaHost.de', 'page_title' => 'Webhosting - Klassisches Hosting für Websites | HexaHost.de',
'page_description' => 'Webhosting mit PHP, MySQL und SSL-Zertifikaten. Klassisches Hosting für Websites ab 1,99€/Monat bei HexaHost.de', 'page_description' => 'Webhosting mit Plesk, PHP und SSL-Zertifikaten. Klassisches Hosting für Websites ab 4,99€/Monat bei HexaHost.de',
'packages' => [ 'packages' => [
'starter' => [ 'starter' => [
'name' => 'Webhosting Starter', 'name' => 'Webhosting Starter',
'price' => '1,99', 'price' => '4,99',
'featured' => false, 'featured' => false,
'specs' => [ 'specs' => [
['label' => 'Webspace', 'value' => '5 GB'], ['label' => 'Webspace', 'value' => '10 GB'],
['label' => 'Domains', 'value' => '1'], ['label' => 'Domains inkl.', 'value' => '1'],
['label' => 'E-Mail-Postfächer', 'value' => '5'], ['label' => 'Subdomains', 'value' => '5'],
['label' => 'Datenbanken', 'value' => '1 MySQL'], ['label' => 'Domain-Alias', 'value' => '2'],
['label' => 'Traffic', 'value' => '10 GB'], ['label' => 'E-Mail-Postfächer', 'value' => '10'],
['label' => 'Datenbanken', 'value' => '2 MySQL'],
['label' => 'Traffic', 'value' => '100 GB'],
], ],
'features' => [ 'features' => [
'cPanel/Webmin', 'Perfekt für kleine Websites und Blogs',
'PHP 8.1', 'Plesk',
'SSL-Zertifikat', 'PHP 8.4 (FastCGI), Git, WP Toolkit, Composer',
'E-Mail-Postfächer', 'SSL-Zertifikat (Let\'s Encrypt)',
'MySQL Datenbank', 'E-Mail-Postfächer à 100MB',
'1-Klick-Apps - WordPress, Joomla, TYPO3, MediaWiki u. v. m.',
], ],
], ],
'business' => [ 'business' => [
'name' => 'Webhosting Business', 'name' => 'Webhosting Business',
'price' => '4,99', 'price' => '7,99',
'featured' => true, 'featured' => true,
'specs' => [ 'specs' => [
['label' => 'Webspace', 'value' => '20 GB'], ['label' => 'Webspace', 'value' => '30 GB'],
['label' => 'Domains', 'value' => '5'], ['label' => 'Domains inkl.', 'value' => '1'],
['label' => 'E-Mail-Postfächer', 'value' => '25'], ['label' => 'Subdomains', 'value' => '10'],
['label' => 'Domain-Alias', 'value' => '2'],
['label' => 'E-Mail-Postfächer', 'value' => '20'],
['label' => 'Datenbanken', 'value' => '5 MySQL'], ['label' => 'Datenbanken', 'value' => '5 MySQL'],
['label' => 'Traffic', 'value' => '50 GB'], ['label' => 'Traffic', 'value' => '100 GB'],
], ],
'features' => [ 'features' => [
'cPanel/Webmin', 'Perfekt für mittlere Websites und Blogs',
'PHP 8.1', 'Plesk',
'SSL-Zertifikat', 'PHP 8.4 (FastCGI), Git, WP Toolkit, Composer',
'E-Mail-Postfächer', 'SSL-Zertifikat (Let\'s Encrypt)',
'MySQL Datenbanken', 'E-Mail-Postfächer à 100MB',
'Backup-Service', '1-Klick-Apps - WordPress, Joomla, TYPO3, MediaWiki u. v. m.',
], ],
], ],
'professional' => [ 'professional' => [
@@ -378,39 +383,42 @@ $PRODUCTS['webhosting'] = [
'featured' => false, 'featured' => false,
'specs' => [ 'specs' => [
['label' => 'Webspace', 'value' => '50 GB'], ['label' => 'Webspace', 'value' => '50 GB'],
['label' => 'Domains', 'value' => 'Unbegrenzt'], ['label' => 'Domains inkl.', 'value' => '3'],
['label' => 'Subdomains', 'value' => 'Unbegrenzt'],
['label' => 'Domain-Alias', 'value' => 'Unbegrenzt'],
['label' => 'E-Mail-Postfächer', 'value' => '100'], ['label' => 'E-Mail-Postfächer', 'value' => '100'],
['label' => 'Datenbanken', 'value' => 'Unbegrenzt'], ['label' => 'Datenbanken', 'value' => '20 MySQL'],
['label' => 'Traffic', 'value' => '200 GB'], ['label' => 'Traffic', 'value' => '100 GB'],
], ],
'features' => [ 'features' => [
'cPanel/Webmin', 'Perfekt für größere Websites und Blogs',
'PHP 8.1', 'Plesk',
'SSL-Zertifikat', 'PHP 8.4 (FastCGI), Git, WP Toolkit, Composer',
'E-Mail-Postfächer', 'SSL-Zertifikat (Let\'s Encrypt)',
'MySQL Datenbanken', 'E-Mail-Postfächer à 100MB',
'Backup-Service', '1-Klick-Apps - WordPress, Joomla, TYPO3, MediaWiki u. v. m.',
'Priority Support',
], ],
], ],
'enterprise' => [ 'enterprise' => [
'name' => 'Webhosting Enterprise', 'name' => 'Webhosting Enterprise',
'price' => '19,99', 'price' => '29,99',
'featured' => false, 'featured' => false,
'specs' => [ 'specs' => [
['label' => 'Webspace', 'value' => '100 GB'], ['label' => 'Webspace', 'value' => '200 GB'],
['label' => 'Domains', 'value' => 'Unbegrenzt'], ['label' => 'Domains inkl.', 'value' => '5'],
['label' => 'Subdomains', 'value' => 'Unbegrenzt'],
['label' => 'Domain-Alias', 'value' => 'Unbegrenzt'],
['label' => 'E-Mail-Postfächer', 'value' => 'Unbegrenzt'], ['label' => 'E-Mail-Postfächer', 'value' => 'Unbegrenzt'],
['label' => 'Datenbanken', 'value' => 'Unbegrenzt'], ['label' => 'Datenbanken', 'value' => '50 MySQL'],
['label' => 'Traffic', 'value' => '500 GB'], ['label' => 'Traffic', 'value' => '1 TB'],
], ],
'features' => [ 'features' => [
'cPanel/Webmin', 'Perfekt für Enterprise-Websites und Blogs',
'PHP 8.1', 'Plesk',
'SSL-Zertifikat', 'PHP 8.4 (FastCGI), Git, WP Toolkit, Composer',
'E-Mail-Postfächer', 'SSL-Zertifikat (Let\'s Encrypt)',
'MySQL Datenbanken', 'E-Mail-Postfächer à 100MB',
'Backup-Service', '1-Klick-Apps - WordPress, Joomla, TYPO3, MediaWiki u. v. m.',
'Priority Support', 'Priority Support',
'Individuelle Konfiguration', 'Individuelle Konfiguration',
], ],

View File

@@ -1,145 +1,34 @@
# HexaHost.de Kontaktformular - Status-Überprüfung # HexaHost.de Kontaktformular - Status
## ✅ Behobene Probleme ## Aktueller Stand
### 1. Merge-Konflikt in contact-handler.php - Kontaktformular und Handler sind funktionsfähig
- **Problem**: Git-Merge-Konflikt machte die Datei unbrauchbar - Versand erfolgt nativ über PHP `mail()`
- **Lösung**: Konflikt aufgelöst, saubere Version erstellt - Keine PHPMailer-/Composer-Abhängigkeit mehr
- **Status**: ✅ Behoben
### 2. CSRF-Token Problem ## Sicherheitsfunktionen
- **Problem**: HTML-Formular versuchte PHP-Code zu verwenden
- **Lösung**: CSRF-Token durch Honeypot-Feld ersetzt
- **Status**: ✅ Behoben
### 3. JavaScript-Merge-Konflikt - CSRF-Token-Prüfung
- **Problem**: Merge-Konflikt in contact.js - Rate Limiting pro IP
- **Lösung**: Konflikt aufgelöst - Honeypot gegen Bots
- **Status**: ✅ Behoben - E-Mail-Validierung und Input-Sanitization
## ⚠️ Noch zu behebende Probleme ## Konfiguration für Produktivbetrieb
### 1. SMTP-Konfiguration Datei: `backend/config/mail-config.php`
- **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 Zu prüfen:
- **Problem**: Composer ist nicht installiert - `SMTP_FROM_EMAIL` ist eine gültige Absenderadresse
- **Aktueller Status**: Fallback auf native PHP mail() Funktion - `SMTP_TO_EMAIL` ist das richtige Zielpostfach
- **Erforderlich**: Composer installieren und PHPMailer einrichten - `mail()` ist beim Hoster aktiv
- **Status**: ⚠️ Optional (Fallback funktioniert)
## 📧 E-Mail-Funktionalität ## Testempfehlung
### Aktuelle Konfiguration 1. `scripts/test-email.php` ausführen
- **SMTP-Host**: smtp.gmail.com 2. Kontaktformular über `contact.php` absenden
- **Port**: 587 3. Empfang und Darstellung der E-Mail prüfen
- **Verschlüsselung**: TLS
- **Fallback**: Native PHP mail() Funktion
### Sicherheitsfeatures ## Hinweis
- ✅ Rate Limiting (5 Anfragen/Stunde)
- ✅ Honeypot-Schutz
- ✅ Input-Sanitization
- ✅ E-Mail-Validierung
- ✅ Anti-Spam-Headers
### E-Mail-Templates Falls der Versand nicht funktioniert, liegt die Ursache in der Regel an der Server-Mailkonfiguration (MTA/`mail()`), nicht am Formular-Code.
- ✅ 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.

View File

@@ -2,172 +2,54 @@
## Übersicht ## Ü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 Datei: `backend/config/mail-config.php`
- Der Git-Merge-Konflikt wurde aufgelöst
- Die Datei ist jetzt funktionsfähig
### 2. ⚠️ Zu beheben: SMTP-Konfiguration Mindestens diese Werte müssen korrekt gesetzt sein:
- Die SMTP-Einstellungen sind noch auf Testwerte gesetzt
- Sie müssen mit echten SMTP-Daten konfiguriert werden
### 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 ```php
'smtp_host' => 'smtp.gmail.com', define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de');
'smtp_port' => 587, define('SMTP_TO_EMAIL', 'info@hexahost.de');
'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',
``` ```
### Option 2: Eigener Mail-Server ## Voraussetzungen auf dem Server
1. **SMTP-Daten von Ihrem Hosting-Provider erhalten** - `mail()` muss in der PHP-Umgebung aktiviert sein
2. **config.php bearbeiten:** - Ein Mail Transfer Agent (MTA) bzw. Mailversand beim Hoster muss funktionieren
```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 ## Test der E-Mail-Funktion
#### Outlook/Hotmail: 1. Per Script testen:
```php - `scripts/test-email.php`
'smtp_host' => 'smtp-mail.outlook.com', 2. Kontaktformular testen:
'smtp_port' => 587, - Seite `contact.php` öffnen
'smtp_encryption' => 'tls', - Formular absenden
``` - Empfang im Zielpostfach prüfen
#### 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)**
## Fehlerbehebung ## 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"** ### Nachricht kommt nicht an
- Überprüfen Sie Host und Port - Spam-Ordner prüfen
- Prüfen Sie Firewall-Einstellungen - Absenderadresse (`SMTP_FROM_EMAIL`) auf gültige Domain setzen
- PHP-Error-Log prüfen
2. **"Authentication failed"** ### Versand funktioniert lokal nicht
- Überprüfen Sie Benutzername und Passwort - Unter Windows/Lokalumgebung ist oft kein SMTP in `php.ini` konfiguriert
- Bei Gmail: App-Passwort verwenden - Auf dem echten Webserver testen
3. **"Connection timeout"** ## Sicherheit
- Prüfen Sie Internetverbindung
- Überprüfen Sie SMTP-Host
4. **"Mail function not available"** Das Kontaktformular beinhaltet bereits:
- PHP mail() Funktion ist deaktiviert - CSRF-Schutz
- Kontaktieren Sie Ihren Hosting-Provider - 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

View File

@@ -52,15 +52,6 @@
Deny from all Deny from all
</Files> </Files>
<Files "composer.json">
Order allow,deny
Deny from all
</Files>
<Files "composer.lock">
Order allow,deny
Deny from all
</Files>
# Config-Verzeichnis schützen # Config-Verzeichnis schützen
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
@@ -77,11 +68,6 @@
RewriteRule ^logs/ - [F,L] RewriteRule ^logs/ - [F,L]
</IfModule> </IfModule>
# Vendor-Verzeichnis schützen
<IfModule mod_rewrite.c>
RewriteRule ^vendor/ - [F,L]
</IfModule>
# Cache-Header für statische Dateien # Cache-Header für statische Dateien
<IfModule mod_expires.c> <IfModule mod_expires.c>
ExpiresActive On ExpiresActive On

View File

@@ -41,9 +41,9 @@ includeHeader($page_title, $page_description, $current_page);
<h2 class="section-title">Unsere Geschichte</h2> <h2 class="section-title">Unsere Geschichte</h2>
<p> <p>
HexaHost.de wurde von mir, Samuel Müller, mit der Vision gegründet, zuverlässiges HexaHost.de wurde von mir, Samuel Müller, mit der Vision gegründet, zuverlässiges
und preiswertes Hosting und IT-Lösungen direkt aus Deutschland anzubieten. Als regionales und preiswertes Hosting und IT-Lösungen direkt aus Bayern anzubieten. Als regionales
Unternehmen aus Niederbayern verstehe ich die Bedürfnisse meiner Kunden Unternehmen aus Niederbayern verstehe ich die Bedürfnisse meiner Kunden
und bieten persönlichen Support. und biete persönlichen Support.
</p> </p>
<p> <p>
Meine Expertise liegt in der Bereitstellung moderner Hosting- und IT-Lösungen Meine Expertise liegt in der Bereitstellung moderner Hosting- und IT-Lösungen

View File

@@ -1,19 +0,0 @@
{
"name": "hexahost/contact-form",
"description": "HexaHost.de Contact Form with PHPMailer",
"type": "project",
"require": {
"phpmailer/phpmailer": "^6.8"
},
"autoload": {
"psr-4": {
"HexaHost\\": "src/"
}
},
"config": {
"optimize-autoloader": true,
"sort-packages": true
},
"minimum-stability": "stable",
"prefer-stable": true
}

View File

@@ -1,18 +1,13 @@
<?php <?php
/** /**
* HexaHost.de Contact Form Handler * HexaHost.de Contact Form Handler
* E-Mail-Verarbeitung mit SMTP-Integration und Spam-Schutz * E-Mail-Verarbeitung mit nativer PHP-mail()-Funktion und Spam-Schutz
*/ */
require_once __DIR__ . '/../backend/includes/functions.php'; require_once __DIR__ . '/../backend/includes/functions.php';
require_once __DIR__ . '/../backend/config/mail-config.php'; require_once __DIR__ . '/../backend/config/mail-config.php';
require_once __DIR__ . '/../backend/config/contact-config.php'; require_once __DIR__ . '/../backend/config/contact-config.php';
// PHPMailer Autoload (falls via Composer installiert)
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
}
$config = getHexaHostConfig(); $config = getHexaHostConfig();
// CORS Headers für AJAX-Requests (nur eigene Domain erlauben) // CORS Headers für AJAX-Requests (nur eigene Domain erlauben)
@@ -102,53 +97,6 @@ function getSubjectLabel($subjectKey) {
function sendEmail($data) { function sendEmail($data) {
global $config; global $config;
if (!class_exists('PHPMailer\PHPMailer\PHPMailer')) {
return sendEmailNative($data);
}
try {
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
$mail->isSMTP();
$mail->Host = $config['smtp_host'];
$mail->SMTPAuth = true;
$mail->Username = $config['smtp_username'];
$mail->Password = $config['smtp_password'];
$mail->SMTPSecure = $config['smtp_encryption'];
$mail->Port = $config['smtp_port'];
$mail->CharSet = 'UTF-8';
$mail->setFrom($config['from_email'], $config['from_name']);
$mail->addReplyTo(
sanitizeHeaderValue($data['email']),
sanitizeHeaderValue($data['firstName'] . ' ' . $data['lastName'])
);
$mail->addAddress($config['to_email'], $config['to_name']);
$subject = getSubjectLabel($data['subject']);
$mail->Subject = '[HexaHost.de] ' . $subject;
$mail->isHTML(true);
$mail->Body = generateEmailHTML($data);
$mail->AltBody = generateEmailText($data);
$mail->addCustomHeader('X-Mailer', 'HexaHost 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->send();
return true;
} catch (Exception $e) {
error_log('HexaHost Contact Form Error: ' . $e->getMessage());
return false;
}
}
function sendEmailNative($data) {
global $config;
$subject = '[HexaHost.de] ' . getSubjectLabel($data['subject']); $subject = '[HexaHost.de] ' . getSubjectLabel($data['subject']);
$replyName = sanitizeHeaderValue($data['firstName'] . ' ' . $data['lastName']); $replyName = sanitizeHeaderValue($data['firstName'] . ' ' . $data['lastName']);
$replyEmail = sanitizeHeaderValue($data['email']); $replyEmail = sanitizeHeaderValue($data['email']);
@@ -165,6 +113,7 @@ function sendEmailNative($data) {
'X-Report-Abuse: Please report abuse here: abuse@hexahost.de', 'X-Report-Abuse: Please report abuse here: abuse@hexahost.de',
]; ];
// Native PHP Mailversand ohne externe Libraries
return mail($config['to_email'], $subject, generateEmailHTML($data), implode("\r\n", $headers)); return mail($config['to_email'], $subject, generateEmailHTML($data), implode("\r\n", $headers));
} }