diff --git a/mail.php b/mail.php new file mode 100755 index 0000000..a571373 --- /dev/null +++ b/mail.php @@ -0,0 +1,155 @@ +CharSet = 'UTF-8'; + $mail->isSMTP(); + $mail->Host = SMTP_HOST; + $mail->SMTPAuth = true; + $mail->Username = SMTP_USERNAME; + $mail->Password = SMTP_PASSWORD; + $mail->SMTPSecure = SMTP_ENCRYPTION; + $mail->Port = SMTP_PORT; + $mail->setFrom(MAIL_FROM_ADDRESS, MAIL_FROM_NAME); + + $html_body = "
Hallo " . htmlspecialchars($r['username']) . ",
\n" . nl2br(htmlspecialchars($body)) . "
\nDein DoMiLi-Admin
"; + $text_body = "Hallo " . $r['username'] . ",\n\n" . $body . "\n\nDein DoMiLi-Admin"; + + $mail->isHTML(true); + $mail->Subject = $subject; + $mail->Body = $html_body; + $mail->AltBody = $text_body; + $mail->addAddress($r['email']); + $mail->send(); + } catch (Exception $e) { + error_log("Mail-Fehler an {$r['email']}: " . $mail->ErrorInfo); + } + } + $message = "E-Mail wurde an " . count($recipients) . " Empfänger gesendet."; + $message_type = 'success'; + } + } + } + } +} + +$all_users = get_all_users($conn); + +require_once('inc/header.php'); +?> + +