<?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require __DIR__ . '/vendor/autoload.php'; function send_smtp_email($to_email, $subject, $body, $reply_to_email = '', $from_name = 'K2BC Website') { $mail = new PHPMailer(true); try { //Server settings $mail->isSMTP(); // Send using SMTP $mail->Host = 'smtp.your-email-provider.com'; // Set the SMTP server to send through $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'your-email@example.com'; // SMTP username $mail->Password = 'your-email-password'; // SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // Enable implicit TLS encryption $mail->Port = 465; // TCP port to connect to; use 587 if `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('no-reply@k2bc.com', $from_name); // This should be an email address hosted on your domain $mail->addAddress($to_email); // Add a recipient if (!empty($reply_to_email)) { $mail->addReplyTo($reply_to_email); } // Content $mail->isHTML(false); // Set email format to plain text $mail->Subject = $subject; $mail->Body = $body; $mail->send(); return true; } catch (Exception $e) { error_log("Message could not be sent. Mailer Error: {$mail->ErrorInfo}"); return false; } } ?>