#122_umlaute_kontaktformular #123
@ -13,8 +13,23 @@ function sanitize_text(string $name, string $type) {
|
|||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function prepare_message_body($message) {
|
||||||
|
// Replace HTML-Entities with actual carriage returns and line feeds
|
||||||
|
$message = str_replace(" ", "\r", $message);
|
||||||
|
$message = str_replace(" ", "\r", $message);
|
||||||
|
|
||||||
|
// Ensure line breaks via carriage return + line feed
|
||||||
|
$message = str_replace("\r\n", "\n", $message);
|
||||||
|
$message = str_replace("\n", "\r\n", $message);
|
||||||
|
|
||||||
|
$message = "Nachricht von: $name\r\n\r\n" . $message;
|
||||||
|
$message = base64_encode($message);
|
||||||
|
|
||||||
|
return $message;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sending email (Platzhalter)
|
* Sending email
|
||||||
*
|
*
|
||||||
* mail(): Braucht auf dem Server einen korrekt konfigurierten Mailserver
|
* mail(): Braucht auf dem Server einen korrekt konfigurierten Mailserver
|
||||||
* phpmailer: Bibliothek, der per Composer installiert wird. Tut ganz gut mit SMTP.
|
* phpmailer: Bibliothek, der per Composer installiert wird. Tut ganz gut mit SMTP.
|
||||||
@ -22,12 +37,14 @@ function sanitize_text(string $name, string $type) {
|
|||||||
function send_message_to_office($subject, $message, $name, $email) {
|
function send_message_to_office($subject, $message, $name, $email) {
|
||||||
return mail(
|
return mail(
|
||||||
getenv('WTF_CONTACT_TO'),
|
getenv('WTF_CONTACT_TO'),
|
||||||
$subject,
|
"=?UTF-8?B?" . base64_encode($subject) . "?=",
|
||||||
$name . "\r\n" . $message,
|
prepare_message_body($message),
|
||||||
$additional_headers = array(
|
$additional_headers = array(
|
||||||
"From" => getenv('WTF_CONTACT_FROM'),
|
"From" => getenv('WTF_CONTACT_FROM'),
|
||||||
"Reply-To" => $email,
|
"Reply-To" => $email,
|
||||||
"Return-Path" => getenv('WTF_RETURN_PATH'),
|
"Return-Path" => getenv('WTF_RETURN_PATH'),
|
||||||
|
"Content-Type" => "text/plain; charset=utf-8",
|
||||||
|
"Content-Transfer-Encoding" => "base64",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user