This commit is contained in:
smueller
2026-05-27 13:14:23 +02:00
5 changed files with 34 additions and 3 deletions

View File

@@ -31,21 +31,34 @@ define('ADDITIONAL_HEADERS', [
]); ]);
define('ALLOWED_EMAIL_DOMAINS', [ define('ALLOWED_EMAIL_DOMAINS', [
]); ]);
define('BLACKLISTED_EMAILS', [ define('BLACKLISTED_EMAILS', [
]); ]);
if (!defined('SMTP_HOST') || !defined('SMTP_USERNAME') || !defined('SMTP_PASSWORD')) {
die('SMTP-Konfiguration ist unvollständig. Bitte überprüfen Sie die mail-config.php');
}
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');
} }
@@ -72,17 +85,20 @@ function logEmail($type, $data) {
} }
function isValidEmail($email) { function isValidEmail($email) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
return false; return false;
} }
if (in_array($email, BLACKLISTED_EMAILS)) { if (in_array($email, BLACKLISTED_EMAILS)) {
return false; return false;
} }
if (!empty(ALLOWED_EMAIL_DOMAINS)) { if (!empty(ALLOWED_EMAIL_DOMAINS)) {
$domain = substr(strrchr($email, "@"), 1); $domain = substr(strrchr($email, "@"), 1);
if (!in_array($domain, ALLOWED_EMAIL_DOMAINS)) { if (!in_array($domain, ALLOWED_EMAIL_DOMAINS)) {
@@ -94,6 +110,7 @@ function isValidEmail($email) {
} }
function getHexaHostConfig($key = null) { function getHexaHostConfig($key = null) {
$config = [ $config = [
@@ -103,6 +120,7 @@ function getHexaHostConfig($key = null) {
'to_name' => 'HexaHost Support', 'to_name' => 'HexaHost Support',
'max_requests_per_hour' => MAX_REQUESTS_PER_HOUR, 'max_requests_per_hour' => MAX_REQUESTS_PER_HOUR,
'honeypot_field' => 'website', 'honeypot_field' => 'website',
'enable_csrf' => ENABLE_CSRF_PROTECTION, 'enable_csrf' => ENABLE_CSRF_PROTECTION,
@@ -110,6 +128,7 @@ function getHexaHostConfig($key = null) {
'max_message_length' => MAX_MESSAGE_LENGTH, 'max_message_length' => MAX_MESSAGE_LENGTH,
'debug_mode' => DEBUG_MODE, 'debug_mode' => DEBUG_MODE,
'log_errors' => LOG_EMAILS, 'log_errors' => LOG_EMAILS,
]; ];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,10 @@
define('SMTP_HOST', 'smtp.ihre-domain.de');
define('SMTP_PORT', 587);
define('SMTP_USERNAME', 'kontakt@ihre-domain.de');
define('SMTP_PASSWORD', 'ihr-smtp-passwort');
define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de'); define('SMTP_FROM_EMAIL', 'kontakt@hexahost.de');
define('SMTP_TO_EMAIL', 'info@hexahost.de'); define('SMTP_TO_EMAIL', 'info@hexahost.de');
@@ -46,6 +50,9 @@ define('BLACKLISTED_EMAILS', [
]); ]);
if (!defined('SMTP_HOST') || !defined('SMTP_USERNAME') || !defined('SMTP_PASSWORD')) {
die('SMTP-Konfiguration ist unvollständig. Bitte überprüfen Sie die mail-config.php');
}
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');
} }
@@ -97,6 +104,11 @@ function isValidEmail($email) {
function getHexaHostConfig($key = null) { function getHexaHostConfig($key = null) {
$config = [ $config = [
'smtp_host' => SMTP_HOST,
'smtp_port' => SMTP_PORT,
'smtp_username' => SMTP_USERNAME,
'smtp_password' => SMTP_PASSWORD,
'smtp_encryption' => 'tls',
'from_email' => SMTP_FROM_EMAIL, 'from_email' => SMTP_FROM_EMAIL,
'from_name' => 'HexaHost.de Kontaktformular', 'from_name' => 'HexaHost.de Kontaktformular',
'to_email' => SMTP_TO_EMAIL, 'to_email' => SMTP_TO_EMAIL,