File: /home/bibuzptr/elearning.bibu-edu.us/app/send_email.php
<?php
session_start();
include_once('../includes/db_connect.php');
include_once "../includes/swiftmailer/swift_required.php";
$base_url="https://www.elearning.bibu-edu.us/";
if(isset($_POST['email'])){
extract($_POST);
$email = trim(mysqli_real_escape_string($con, $_POST['email']));
$emencoded = base64_encode($email);
// $chkuser = mysqli_query($con,"SELECT * FROM students WHERE email = '$email'");
// if(mysqli_num_rows($chkuser) > 0){
// $row = mysqli_fetch_assoc($chkuser);
// $fname = $row["name"];
// $link = $base_url."setpassword/".$emencoded;
$notif = mysqli_fetch_assoc(mysqli_query($con,"SELECT * FROM notification_templates WHERE id='15'"));
$transport = Swift_SmtpTransport::newInstance('bibu-edu.us', 465, "ssl")
->setUsername('notification@bibu-edu.us')
->setPassword('@notif2019!');
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance($notif["subject"])
->setFrom(array('notification@bibu-edu.us' => 'Breakthrough International College & University'))
->setTo(array('Patnju4@gmail.com' => 'Admin'))
->setContentType('text/html; charset=utf-8')
->setBody(str_replace(array("{name}","{email}","{phone}","{coursename}"),array($name,$email,$phone,$coursename),$notif["body"]));
$numSent = $mailer->send($message);
echo "success";
// }else{
// echo "notfound";
// }
}
?>