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:
26
README.md
26
README.md
@@ -46,7 +46,7 @@ Eine moderne und umfangreiche Website für das Hosting-Unternehmen HexaHost.de a
|
||||
- **HTML5** - Semantisches Markup
|
||||
- **CSS3** - Moderne Styles mit Custom Properties
|
||||
- **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
|
||||
- **CSS Grid & Flexbox** - Responsive Layouts
|
||||
- **Inter Font** - Moderne Typografie
|
||||
@@ -73,7 +73,6 @@ HexaHost-Frontend/
|
||||
│ ├── sitemap.xml # SEO Sitemap
|
||||
│ ├── favicon.svg # Website Icon
|
||||
│ ├── .htaccess # Apache Konfiguration
|
||||
│ ├── composer.json # PHP Dependencies
|
||||
│ ├── config/ # ⬅ vom Backend
|
||||
│ │ ├── config.php # Allgemeine Konfiguration
|
||||
│ │ └── mail-config.php # E-Mail-Konfiguration
|
||||
@@ -127,7 +126,6 @@ HexaHost-Frontend/
|
||||
|
||||
### Voraussetzungen
|
||||
- PHP 8.0 oder höher
|
||||
- Composer (für PHPMailer)
|
||||
- Apache mit mod_rewrite (für .htaccess)
|
||||
- [HexaHost-Backend](../HexaHost-Backend) Repository
|
||||
|
||||
@@ -147,24 +145,18 @@ HexaHost-Frontend/
|
||||
cp -r HexaHost-Backend/includes/* HexaHost-Frontend/public/includes/
|
||||
```
|
||||
|
||||
3. **PHP Dependencies installieren**
|
||||
```bash
|
||||
cd HexaHost-Frontend/public
|
||||
composer install
|
||||
```
|
||||
|
||||
4. **Konfiguration anpassen**
|
||||
3. **Konfiguration anpassen**
|
||||
```bash
|
||||
# mail-config.php mit SMTP-Daten bearbeiten
|
||||
nano config/mail-config.php
|
||||
```
|
||||
|
||||
5. **Lokaler Development Server**
|
||||
4. **Lokaler Development Server**
|
||||
```bash
|
||||
php -S localhost:8000 -t public
|
||||
```
|
||||
|
||||
6. **Website öffnen**
|
||||
5. **Website öffnen**
|
||||
```
|
||||
http://localhost:8000
|
||||
```
|
||||
@@ -208,13 +200,11 @@ Detaillierte Informationen zu den Backend-Komponenten finden Sie in der [Backend
|
||||
|
||||
## 📧 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
|
||||
define('SMTP_HOST', 'mail.example.com');
|
||||
define('SMTP_PORT', 587);
|
||||
define('SMTP_USER', 'noreply@hexahost.de');
|
||||
define('SMTP_PASS', 'your-password');
|
||||
define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de');
|
||||
define('SMTP_TO_EMAIL', 'info@hexahost.de');
|
||||
```
|
||||
|
||||
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
|
||||
- Server-seitige Validierung
|
||||
- E-Mail-Versand via SMTP
|
||||
- E-Mail-Versand via native PHP mail()
|
||||
- CSRF-Schutz
|
||||
- Auto-Fill basierend auf URL-Parametern
|
||||
- FAQ-Sektion mit Accordion
|
||||
|
||||
@@ -2,49 +2,12 @@
|
||||
/**
|
||||
* HexaHost.de Mail Configuration
|
||||
*
|
||||
* Bitte passen Sie die folgenden SMTP-Einstellungen an Ihre E-Mail-Provider an.
|
||||
*
|
||||
* 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
|
||||
* Dieses Projekt versendet E-Mails nativ über PHP mail().
|
||||
* Es sind keine externen Bibliotheken oder Composer-Installationen erforderlich.
|
||||
*/
|
||||
|
||||
// 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
|
||||
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
|
||||
|
||||
// Sicherheitseinstellungen
|
||||
@@ -87,11 +50,6 @@ define('BLACKLISTED_EMAILS', [
|
||||
// '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
|
||||
if (!filter_var(SMTP_FROM_EMAIL, FILTER_VALIDATE_EMAIL)) {
|
||||
die('Ungültige SMTP_FROM_EMAIL Adresse');
|
||||
@@ -149,13 +107,6 @@ function isValidEmail($email) {
|
||||
*/
|
||||
function getHexaHostConfig($key = null) {
|
||||
$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
|
||||
'from_email' => SMTP_FROM_EMAIL,
|
||||
'from_name' => 'HexaHost.de Kontaktformular',
|
||||
|
||||
@@ -323,53 +323,58 @@ $PRODUCTS['webhosting'] = [
|
||||
'name' => 'Webhosting',
|
||||
'short_name' => 'Webhosting',
|
||||
'description' => 'Klassisches Hosting mit PHP, MySQL und SSL',
|
||||
'min_price' => '1,99',
|
||||
'min_price' => '4,99',
|
||||
'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_description' => 'Von der ersten Website bis zum professionellen Online-Shop',
|
||||
'cta_title' => 'Bereit für Ihr Webhosting?',
|
||||
'cta_description' => 'Starten Sie noch heute mit professionellem Webhosting',
|
||||
'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' => [
|
||||
'starter' => [
|
||||
'name' => 'Webhosting Starter',
|
||||
'price' => '1,99',
|
||||
'price' => '4,99',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'Webspace', 'value' => '5 GB'],
|
||||
['label' => 'Domains', 'value' => '1'],
|
||||
['label' => 'E-Mail-Postfächer', 'value' => '5'],
|
||||
['label' => 'Datenbanken', 'value' => '1 MySQL'],
|
||||
['label' => 'Traffic', 'value' => '10 GB'],
|
||||
['label' => 'Webspace', 'value' => '10 GB'],
|
||||
['label' => 'Domains inkl.', 'value' => '1'],
|
||||
['label' => 'Subdomains', 'value' => '5'],
|
||||
['label' => 'Domain-Alias', 'value' => '2'],
|
||||
['label' => 'E-Mail-Postfächer', 'value' => '10'],
|
||||
['label' => 'Datenbanken', 'value' => '2 MySQL'],
|
||||
['label' => 'Traffic', 'value' => '100 GB'],
|
||||
],
|
||||
'features' => [
|
||||
'cPanel/Webmin',
|
||||
'PHP 8.1',
|
||||
'SSL-Zertifikat',
|
||||
'E-Mail-Postfächer',
|
||||
'MySQL Datenbank',
|
||||
'Perfekt für kleine Websites und Blogs',
|
||||
'Plesk',
|
||||
'PHP 8.4 (FastCGI), Git, WP Toolkit, Composer',
|
||||
'SSL-Zertifikat (Let\'s Encrypt)',
|
||||
'E-Mail-Postfächer à 100MB',
|
||||
'1-Klick-Apps - WordPress, Joomla, TYPO3, MediaWiki u. v. m.',
|
||||
],
|
||||
],
|
||||
'business' => [
|
||||
'name' => 'Webhosting Business',
|
||||
'price' => '4,99',
|
||||
'price' => '7,99',
|
||||
'featured' => true,
|
||||
'specs' => [
|
||||
['label' => 'Webspace', 'value' => '20 GB'],
|
||||
['label' => 'Domains', 'value' => '5'],
|
||||
['label' => 'E-Mail-Postfächer', 'value' => '25'],
|
||||
['label' => 'Webspace', 'value' => '30 GB'],
|
||||
['label' => 'Domains inkl.', 'value' => '1'],
|
||||
['label' => 'Subdomains', 'value' => '10'],
|
||||
['label' => 'Domain-Alias', 'value' => '2'],
|
||||
['label' => 'E-Mail-Postfächer', 'value' => '20'],
|
||||
['label' => 'Datenbanken', 'value' => '5 MySQL'],
|
||||
['label' => 'Traffic', 'value' => '50 GB'],
|
||||
['label' => 'Traffic', 'value' => '100 GB'],
|
||||
],
|
||||
'features' => [
|
||||
'cPanel/Webmin',
|
||||
'PHP 8.1',
|
||||
'SSL-Zertifikat',
|
||||
'E-Mail-Postfächer',
|
||||
'MySQL Datenbanken',
|
||||
'Backup-Service',
|
||||
'Perfekt für mittlere Websites und Blogs',
|
||||
'Plesk',
|
||||
'PHP 8.4 (FastCGI), Git, WP Toolkit, Composer',
|
||||
'SSL-Zertifikat (Let\'s Encrypt)',
|
||||
'E-Mail-Postfächer à 100MB',
|
||||
'1-Klick-Apps - WordPress, Joomla, TYPO3, MediaWiki u. v. m.',
|
||||
],
|
||||
],
|
||||
'professional' => [
|
||||
@@ -378,39 +383,42 @@ $PRODUCTS['webhosting'] = [
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['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' => 'Datenbanken', 'value' => 'Unbegrenzt'],
|
||||
['label' => 'Traffic', 'value' => '200 GB'],
|
||||
['label' => 'Datenbanken', 'value' => '20 MySQL'],
|
||||
['label' => 'Traffic', 'value' => '100 GB'],
|
||||
],
|
||||
'features' => [
|
||||
'cPanel/Webmin',
|
||||
'PHP 8.1',
|
||||
'SSL-Zertifikat',
|
||||
'E-Mail-Postfächer',
|
||||
'MySQL Datenbanken',
|
||||
'Backup-Service',
|
||||
'Priority Support',
|
||||
'Perfekt für größere Websites und Blogs',
|
||||
'Plesk',
|
||||
'PHP 8.4 (FastCGI), Git, WP Toolkit, Composer',
|
||||
'SSL-Zertifikat (Let\'s Encrypt)',
|
||||
'E-Mail-Postfächer à 100MB',
|
||||
'1-Klick-Apps - WordPress, Joomla, TYPO3, MediaWiki u. v. m.',
|
||||
],
|
||||
],
|
||||
'enterprise' => [
|
||||
'name' => 'Webhosting Enterprise',
|
||||
'price' => '19,99',
|
||||
'price' => '29,99',
|
||||
'featured' => false,
|
||||
'specs' => [
|
||||
['label' => 'Webspace', 'value' => '100 GB'],
|
||||
['label' => 'Domains', 'value' => 'Unbegrenzt'],
|
||||
['label' => 'Webspace', 'value' => '200 GB'],
|
||||
['label' => 'Domains inkl.', 'value' => '5'],
|
||||
['label' => 'Subdomains', 'value' => 'Unbegrenzt'],
|
||||
['label' => 'Domain-Alias', 'value' => 'Unbegrenzt'],
|
||||
['label' => 'E-Mail-Postfächer', 'value' => 'Unbegrenzt'],
|
||||
['label' => 'Datenbanken', 'value' => 'Unbegrenzt'],
|
||||
['label' => 'Traffic', 'value' => '500 GB'],
|
||||
['label' => 'Datenbanken', 'value' => '50 MySQL'],
|
||||
['label' => 'Traffic', 'value' => '1 TB'],
|
||||
],
|
||||
'features' => [
|
||||
'cPanel/Webmin',
|
||||
'PHP 8.1',
|
||||
'SSL-Zertifikat',
|
||||
'E-Mail-Postfächer',
|
||||
'MySQL Datenbanken',
|
||||
'Backup-Service',
|
||||
'Perfekt für Enterprise-Websites und Blogs',
|
||||
'Plesk',
|
||||
'PHP 8.4 (FastCGI), Git, WP Toolkit, Composer',
|
||||
'SSL-Zertifikat (Let\'s Encrypt)',
|
||||
'E-Mail-Postfächer à 100MB',
|
||||
'1-Klick-Apps - WordPress, Joomla, TYPO3, MediaWiki u. v. m.',
|
||||
'Priority Support',
|
||||
'Individuelle Konfiguration',
|
||||
],
|
||||
|
||||
@@ -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
|
||||
- **Problem**: Git-Merge-Konflikt machte die Datei unbrauchbar
|
||||
- **Lösung**: Konflikt aufgelöst, saubere Version erstellt
|
||||
- **Status**: ✅ Behoben
|
||||
- Kontaktformular und Handler sind funktionsfähig
|
||||
- Versand erfolgt nativ über PHP `mail()`
|
||||
- Keine PHPMailer-/Composer-Abhängigkeit mehr
|
||||
|
||||
### 2. CSRF-Token Problem
|
||||
- **Problem**: HTML-Formular versuchte PHP-Code zu verwenden
|
||||
- **Lösung**: CSRF-Token durch Honeypot-Feld ersetzt
|
||||
- **Status**: ✅ Behoben
|
||||
## Sicherheitsfunktionen
|
||||
|
||||
### 3. JavaScript-Merge-Konflikt
|
||||
- **Problem**: Merge-Konflikt in contact.js
|
||||
- **Lösung**: Konflikt aufgelöst
|
||||
- **Status**: ✅ Behoben
|
||||
- CSRF-Token-Prüfung
|
||||
- Rate Limiting pro IP
|
||||
- Honeypot gegen Bots
|
||||
- E-Mail-Validierung und Input-Sanitization
|
||||
|
||||
## ⚠️ Noch zu behebende Probleme
|
||||
## Konfiguration für Produktivbetrieb
|
||||
|
||||
### 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
|
||||
Datei: `backend/config/mail-config.php`
|
||||
|
||||
### 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)
|
||||
Zu prüfen:
|
||||
- `SMTP_FROM_EMAIL` ist eine gültige Absenderadresse
|
||||
- `SMTP_TO_EMAIL` ist das richtige Zielpostfach
|
||||
- `mail()` ist beim Hoster aktiv
|
||||
|
||||
## 📧 E-Mail-Funktionalität
|
||||
## Testempfehlung
|
||||
|
||||
### Aktuelle Konfiguration
|
||||
- **SMTP-Host**: smtp.gmail.com
|
||||
- **Port**: 587
|
||||
- **Verschlüsselung**: TLS
|
||||
- **Fallback**: Native PHP mail() Funktion
|
||||
1. `scripts/test-email.php` ausführen
|
||||
2. Kontaktformular über `contact.php` absenden
|
||||
3. Empfang und Darstellung der E-Mail prüfen
|
||||
|
||||
### Sicherheitsfeatures
|
||||
- ✅ Rate Limiting (5 Anfragen/Stunde)
|
||||
- ✅ Honeypot-Schutz
|
||||
- ✅ Input-Sanitization
|
||||
- ✅ E-Mail-Validierung
|
||||
- ✅ Anti-Spam-Headers
|
||||
## Hinweis
|
||||
|
||||
### E-Mail-Templates
|
||||
- ✅ HTML-Template mit HexaHost-Design
|
||||
- ✅ Text-Version als Fallback
|
||||
- ✅ Responsive Design
|
||||
- ✅ Strukturierte Darstellung aller Daten
|
||||
Falls der Versand nicht funktioniert, liegt die Ursache in der Regel an der Server-Mailkonfiguration (MTA/`mail()`), nicht am Formular-Code.
|
||||
|
||||
## 🧪 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.
|
||||
@@ -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
|
||||
|
||||
@@ -52,15 +52,6 @@
|
||||
Deny from all
|
||||
</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
|
||||
<IfModule mod_rewrite.c>
|
||||
@@ -77,11 +68,6 @@
|
||||
RewriteRule ^logs/ - [F,L]
|
||||
</IfModule>
|
||||
|
||||
# Vendor-Verzeichnis schützen
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteRule ^vendor/ - [F,L]
|
||||
</IfModule>
|
||||
|
||||
# Cache-Header für statische Dateien
|
||||
<IfModule mod_expires.c>
|
||||
ExpiresActive On
|
||||
|
||||
@@ -41,9 +41,9 @@ includeHeader($page_title, $page_description, $current_page);
|
||||
<h2 class="section-title">Unsere Geschichte</h2>
|
||||
<p>
|
||||
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
|
||||
und bieten persönlichen Support.
|
||||
und biete persönlichen Support.
|
||||
</p>
|
||||
<p>
|
||||
Meine Expertise liegt in der Bereitstellung moderner Hosting- und IT-Lösungen
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -1,18 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* 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/config/mail-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();
|
||||
|
||||
// CORS Headers für AJAX-Requests (nur eigene Domain erlauben)
|
||||
@@ -102,53 +97,6 @@ function getSubjectLabel($subjectKey) {
|
||||
function sendEmail($data) {
|
||||
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']);
|
||||
$replyName = sanitizeHeaderValue($data['firstName'] . ' ' . $data['lastName']);
|
||||
$replyEmail = sanitizeHeaderValue($data['email']);
|
||||
@@ -165,6 +113,7 @@ function sendEmailNative($data) {
|
||||
'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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user