added reply-to header to mails sent via contact form

This commit is contained in:
Tobias Radloff 2025-11-21 08:58:14 +01:00
parent 932e7f3152
commit fdf2f2c03f
2 changed files with 8 additions and 1 deletions

View File

@ -38,7 +38,9 @@ $mailContents = [
'subject' => 'Diese Nachricht kam ueber das Kontaktformular von t-r.de',
'bodyText' => implode("\n\n", $body),
'fromAddress' => $general['notificationAddress'],
'fromName' => 'Tobias Radloffs Kontaktformular'
'fromName' => 'Tobias Radloffs Kontaktformular',
'replyTo' => $_POST['email'],
'name' => $_POST['name']
];
try {

View File

@ -64,6 +64,11 @@ function SendEmail($toAddress, $mailContents) {
// recipient
$mail->addAddress($toAddress);
// reply-to address
if ( isset($mailContents['replyTo']) and isset($mailContents['name']) ) {
$mail->addReplyTo($mailContents['replyTo'], $mailContents['name']);
}
// content
$mail->CharSet = 'UTF-8';
if ( isset($mailContents['bodyHTML']) and $mailContents['bodyHTML'] != '' ) {