Current File : /home/inlingua/www/noida/icentex_noida/conveyance/mail_old.php
<?php
require("../class.phpmailer.php");

$path='rpts/'.$numC['name'].'_'.$numC['month'].'_'.$numC['year'].'_conveyance.pdf';

$queryuser="select * from timesheet_user where recNo='".$numC['instructor']."'";
$resultuser=mysql_query($queryuser) or die(mysql_error());
$numuser=mysql_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.="*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";
$fromName="Conveyance";

$to=$numuser[email];


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




$mail = new PHPMailer();
$domain = "inlinguanewdelhi.in";
$smtpHost = "mail.$domain";
$smtpUser = "admin@$domain";
$smtpPassword = "qftW&525";




    //        $domain = "inlinguanewdelhi.com";

		//    $smtpHost = "mail.$domain";

		  //  $smtpUser = "shrikant@$domain";

		    //$smtpPassword = "Noida007";

//$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($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.="*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;
}



}

    
    
    
    
}

?>