Neue Ziel-E-Mail-Adressen für Antragsbenachrichtigungen

This commit is contained in:
torsten 2026-11-08 19:36:09 +01:00
parent 34304d18dd
commit 5caf55f4a6
6 changed files with 51 additions and 25 deletions

View file

@ -174,21 +174,31 @@ class HomeController
. "Antrag im Admin-Bereich ansehen:\n"
. " " . $adminUrl . "\n";
if (!send_mail(
(string) config('app.membership_notify_email'),
'Neuer Mitgliedsantrag: ' . $vorname . ' ' . $nachname,
$body,
$email
)) {
app_log('warning', 'Admin-Benachrichtigung über neuen Mitgliedsantrag fehlgeschlagen', [
'application_id' => $application->id,
'email' => (string) config('app.membership_notify_email'),
]);
} else {
app_log('info', 'Admin-Benachrichtigung über neuen Mitgliedsantrag gesendet', [
'application_id' => $application->id,
'email' => (string) config('app.membership_notify_email'),
]);
$adminSubject = 'Neuer Mitgliedsantrag: ' . $vorname . ' ' . $nachname;
$adminRecipients = array_values(array_unique((array) config('app.membership_notify_emails')));
$adminSent = false;
foreach ($adminRecipients as $recipient) {
if (!filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
continue;
}
if (!send_mail($recipient, $adminSubject, $body, $email)) {
app_log('warning', 'Admin-Benachrichtigung über neuen Mitgliedsantrag fehlgeschlagen', [
'application_id' => $application->id,
'email' => $recipient,
]);
} else {
$adminSent = true;
app_log('info', 'Admin-Benachrichtigung über neuen Mitgliedsantrag gesendet', [
'application_id' => $application->id,
'email' => $recipient,
]);
}
}
if (!$adminSent) {
app_log('warning', 'Keine gültige Admin-Empfängeradresse konfiguriert');
}
$applicantBody = "Hallo " . trim($vorname . ' ' . $nachname) . ",\n\n"