use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require __DIR__ . '/PHPMailer/src/Exception.php'; require __DIR__ . '/PHPMailer/src/PHPMailer.php'; require __DIR__ . '/PHPMailer/src/SMTP.php'; $mail = new PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'mail.savannahsystems.co.ke'; $mail->SMTPAuth = true; $mail->Username = 'aicfannex@savannahsystems.co.ke'; $mail->Password = SMTP_PASS; $mail->SMTPSecure = 'tls'; $mail->Port = 587; $mail->setFrom('aicfannex@savannahsystems.co.ke', 'AIC Fellowship Annex'); $mail->isHTML(true); $mail->Subject = $subject; $mail->Body = nl2br("

$message


Blessings,
AIC Fellowship Annex Youth Team

"); if (!empty($_FILES['attachment']['name']) && $_FILES['attachment']['error'] === 0) { $mail->addAttachment($_FILES['attachment']['tmp_name'], $_FILES['attachment']['name']); } foreach ($members as $m) { $mail->clearAddresses(); $mail->addAddress($m['email'], $m['name']); $mail->send(); } header("Location: send_announcement.php?success=1"); exit(); } catch (Exception $e) { header("Location: send_announcement.php?error=" . urlencode($mail->ErrorInfo)); exit(); }