git.schokokeks.org
Repositories
Help
Report an Issue
bibweb.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
374e0c1
Branches
Tags
master
bibweb.git
lib
mailer.php
E-Mail-Notification
Bernd Wurst
commited
374e0c1
at 2026-09-30 08:18:05
mailer.php
Blame
History
Raw
<?php require_once(__DIR__.'/../vendor/autoload.php'); require_once("config.php"); use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; function sendMail($subject, $message, $to, $name) { global $config; $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = $config['smtp_server']; $mail->SMTPAuth = true; $mail->Username = $config['smtp_username']; $mail->Password = $config['smtp_password']; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->CharSet = 'UTF-8'; $mail->setFrom('info@mosterei-wurst.de', 'Mosterei Wurst'); $mail->addAddress($to, $name); $mail->Subject = $subject; $mail->Body = $message; $mail->send(); // Flag setzen, damit kein erneuter Versand bei Reloads stattfindet $_SESSION['mail_sent'] = true; return true; } catch (Exception $e) { error_log("E-Mail konnte nicht gesendet werden. PHPMailer Fehler: {$mail->ErrorInfo}"); return false; } }