Current File : /home/inlingua/www/dwarka/icentex/conveyance/mail.php |
<?php
require("../class.phpmailer.php");
$path='rpts/'.$name.'_'.$numC['month'].'_'.$numC['year'].'_conveyance.pdf';
$link='https://inlinguanewdelhi.in/icentex/conveyance/rpts/'.$name.'_'.$numC['month'].'_'.$numC['year'].'_conveyance.pdf';
$queryuser="select * from timesheet_user where recNo='".$numC['instructor']."'";
$resultuser=mysqli_query($conn,$queryuser);
$numuser=mysqli_fetch_array($resultuser);
$to=$numuser['email'];
$message="Hi ".$numuser['name'].",<br>A new Conveyance Sheet has been submitted by you.";
$message.="The details are as follows:<br>Month: ".$numC['month']."<br>Year: ".$numC['year']."<br><br>";
$message.="<a href=".$link.">Download Conveyance Sheet</a><br><br>";
$message.="*If the details in the conveyance sheet are incorrect or you wish to make any changes, please contact the Administrator at hrd@inlinguanewdelhi.com";
$fromEmail= "hrd@inlinguanewdelhi.com";
//$fromEmail= "admin@inlinguanewdelhi.com";
$fromName="Conveyance";
$to=$numuser['email'];
$subject="Conveyance-".$numC['month'].", ".$numC['year']." - ".$numC['name']."";
$tomail_array=array();
array_push($tomail_array,$to);
$domain = "inlinguanewdelhi.in";
$smtpHost = "mail.$domain";
$smtpUser = "admin@$domain";
$smtpPassword = "5B&vp7pgm7flABvi";
/*
$domain = "academycentral.in";
$smtpHost = "mail.$domain";
$smtpUser = "support@academycentral.in";
$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->SetLanguage( 'en', 'phpmailer/language/' );
//$mail->Priority = 1;
}
$mail->From = $fromEmail;
$mail->FromName = $fromName;
foreach ($tomail_array as $toAddress)
{
if($toAddress !=''){
$mail->AddAddress(trim($toAddress),"");
}
}
//$mail->AddAttachment($path);
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $subject;
$mail->Body = $message;
//$mail->AddReplyTo("umraovikas@gmail.com","");
if(!$mail->Send())
{
echo "Message could not be sent on mailid: <font color='red'>'".$toAddress."'";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
$to1=explode(",",$numuser['conveyance_email']);
//print_r($to1);
if(count($to1>0))
{
$message1="Hi <br> ".$numuser['name'].", has submitted a new Conveyance Sheet.<br><br>";
$message1.="The details are as follows:<br>Name: ".$numuser['name']."<br>Month: ".$numC['month']."<br>Year: ".$numC['year']."<br><br>";
$message1.="<a href=".$link.">Download Conveyance Sheet</a><br><br>";
//$message1.="*If the details in the conveyance sheet are incorrect or you wish to make any changes, please contact the Administrator at hrd@inlinguanewdelhi.com";
foreach($to1 as $key=>$val)
{
//$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;
$mail->AddAddress(trim($val), "");
//}
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $subject;
$mail->Body = $message1;
//$mail->AddReplyTo("umraovikas@gmail.com","");
//$mail->AddAttachment($path);
if(!$mail->Send())
{
echo "Message could not be sent on mailid: <font color='red'>'".$val."'</font><br>";
echo "Please check the emailId.<br>";
//echo "Mailer Error: " . $mail->ErrorInfo;
//exit;
}
}
}
?>