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:
@@ -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