<!-- Script for mail send next order 1 day before at 10 mrng-->
<?php
date_default_timezone_set('Canada/Eastern');
//$currentDate = '12/19/2019';
$tomorrow = new DateTime('tomorrow');
$currentDate = $tomorrow->format('m/d/Y');
$time_match_nn=date('H A');
//$time_match_nn='10';
//echo $time_match_nn;
$servername = "localhost";
$username = "xxxxxx";
$password = "xxxxx(*()";
$dbname = "xxxxxxx";
//echo $currentDate;
$conn = new mysqli($servername, $username, $password, $dbname);
if($conn->connect_error) die($conn->connect_error);
$remind_query1 = "SELECT * FROM wp_cbg7ccqh4q_package_order WHERE one_delivery_date= '$currentDate' and $time_match_nn='10 AM' and order_status='1' ";
//echo "SELECT * FROM wp_cbg7ccqh4q_package_order WHERE one_delivery_date= '$currentDate' AND $time_match_nn='10'";
if($run1 = $conn->query($remind_query1))
{
$rows = $run1->num_rows;
for ($j = 0; $j < $rows; ++$j)
{
$run1->data_seek($j);
$row = $run1->fetch_array(MYSQLI_NUM);
$to = 'xxxx.xxxxxx@gmail.com';
$too = $row[27];
$subject = "Next Order Package Reminder";
$message = "Hi ".$row[1]."\nJust a reminder that your package 1 will on the ".$row[25].",\n"
."Please renew your package\n"."\nThank You"."\nEzboxes";
$messager = "Tomorrow Package deliver\nThank You"."\nEzboxes";
$headers = "From: info@xxxxxx.ca";
mail($to,$subject,$message,$headers);
@mail($too,$subject,$messager,$headers);
}
}
?>
<!-- Script for mail send next order 1 day before at 10 mrng-->
No comments:
Post a Comment