Current File : /home/inlingua/public_html/dwarka/icentex/conveyance/corporatemail.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="Corporate Conveyance";

//$to=$numuser[email];
//$to='herman@inlinguanewdelhi.com';
$to='admin@inlinguanewdelhi.in';

$subject="Corporate Conveyance-".$numC['month'].", ".$numC['year']." - ".$numC['name']."";




$mail = new PHPMailer();
$domain = "inlinguanewdelhi.in";
$smtpHost = "mail.$domain";
$smtpUser = "admin@$domain";
$smtpPassword = "5B&vp7pgm7flABvi";

$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($to, "");
//}


$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 on mailid: <font color='red'>'".$to."'</font><br>";
	echo "Please check the emailId.<br>";
    //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();

//$mail->IsSMTP();              // set mailer to use SMTP
//$mail->IsMail();
//$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 = 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;
}



}

    
    
    
    
}

?>