Current File : /home/inlingua/public_html/icentex/admin_attendance/send_report.php |
<?php
ob_start();
include("check_attendance.php");
// Include the database connection details
require('../dbConnection.php');
// Include common functions
require('../commonFunc.php');
// Include common functions
require('../globalVars.php');
// Include the table handler class
require('../dbHandler.class.php');
require("../class.phpmailer.php");
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
$courseID=$_REQUEST['courseID'];
$email=$_REQUEST['email'];
$key=time();
$query="insert into corporate_email_report (email,key1,courseID) values ('".$email."','".$key."','".$courseID."')";
$result=mysqli_query($conn,$query) or die(mysql_error($conn));
$inesrt_id=mysqli_insert_id();
$link="http://inlinguanewdelhi.com/corporate_details/index.php?email_id=".$inesrt_id."&sid=".$key."";
$message="Dear sir<br>Please find the link for attendance details of corporate program:<br><br>".$link."";
$subject="Attendance Details";
$fromEmail= "service@inlinguanewdelhi.com";
$fromName="Inlingua Attendance Admin";
$tomail_array=array($email);
$domain = "inlinguanewdelhi.com";
$smtpHost = "mail.$domain";
$smtpUser = "shrikant@$domain";
$smtpPassword = "Noida007";
$mail = new PHPMailer();
if( $mail_type=="S")
{
$mail->IsSMTP(); // set mailer to use SMTP
}
if( $mail_type=="N")
{
$mail->IsMail();
}
if( $mail_type=="S")
{
$mail->Host = $smtpHost; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = $smtpUser; // SMTP username
$mail->Password = $smtpPassword; // SMTP password
}
$mail->From = $fromEmail;
$mail->FromName = $fromName;
//foreach ($to as $toAddress)
//{
//$toAddress;
foreach ($tomail_array as $toAddress)
{
//$toAddress;
$mail->AddAddress($toAddress, "");
}
//}
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $subject;
$mail->Body = $message;
//$mail->AddReplyTo("umraovikas@gmail.com","");
//$mail->AddAttachment($path);
if(!$mail->Send())
{
echo "Message could not be sent";
echo "Please check the emailId.<br>";
//echo "Mailer Error: " . $mail->ErrorInfo;
//exit;
}
header("Location:attendance.php");
?>