#125_fehler_im_kontaktformular #126

Merged
muli merged 8 commits from #125_fehler_im_kontaktformular into main 2022-08-24 22:41:22 +02:00
Showing only changes of commit 42b9b3a62e - Show all commits

View File

@ -34,17 +34,25 @@ function prepare_message_body(string $message, string $name) {
* phpmailer: Bibliothek, der per Composer installiert wird. Tut ganz gut mit SMTP. * phpmailer: Bibliothek, der per Composer installiert wird. Tut ganz gut mit SMTP.
*/ */
function send_message_to_office(string $subject, string $message, string $name, string $email) { function send_message_to_office(string $subject, string $message, string $name, string $email) {
$returnPath = filter_var(getenv('WTF_RETURN_PATH'), FILTER_VALIDATE_EMAIL);
$to = filter_var(getenv('WTF_CONTACT_TO'), FILTER_VALIDATE_EMAIL);
if (!$returnPath || !$to) {
error_log('Address for "To" or "Return-Path" is invalid');
return false;
}
return mail( return mail(
getenv('WTF_CONTACT_TO'), $to,
"=?UTF-8?B?" . base64_encode($subject) . "?=", "=?UTF-8?B?" . base64_encode($subject) . "?=",
prepare_message_body($message, $name), prepare_message_body($message, $name),
$additional_headers = array( array(
"From" => getenv('WTF_CONTACT_FROM'), "From" => getenv('WTF_CONTACT_FROM'),
"Reply-To" => $email, "Reply-To" => $email,
"Return-Path" => getenv('WTF_RETURN_PATH'),
"Content-Type" => "text/plain; charset=utf-8", "Content-Type" => "text/plain; charset=utf-8",
"Content-Transfer-Encoding" => "base64", "Content-Transfer-Encoding" => "base64",
), ),
"-f $returnPath"
); );
} }