forked from ag_kommunikation/webseite
Set the return path via the envelope sender
This commit is contained in:
parent
590cbfbb65
commit
42b9b3a62e
@ -34,17 +34,25 @@ function prepare_message_body(string $message, string $name) {
|
||||
* 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) {
|
||||
$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(
|
||||
getenv('WTF_CONTACT_TO'),
|
||||
$to,
|
||||
"=?UTF-8?B?" . base64_encode($subject) . "?=",
|
||||
prepare_message_body($message, $name),
|
||||
$additional_headers = array(
|
||||
array(
|
||||
"From" => getenv('WTF_CONTACT_FROM'),
|
||||
"Reply-To" => $email,
|
||||
"Return-Path" => getenv('WTF_RETURN_PATH'),
|
||||
"Content-Type" => "text/plain; charset=utf-8",
|
||||
"Content-Transfer-Encoding" => "base64",
|
||||
),
|
||||
"-f $returnPath"
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user