I am new to php, I am making a schedule page which is getting data form database. From database I am picking the send time and dates of the emails which have come. What am trying to do is that, if the send date and time has come the system should send email to that address.
For email sending i am using this API.
This is my Code what I should add in this to perform such functionality. Am trying to get 3 things. 1. to fetch array from database whose time has been reached. 2. storing them in array using loop. 3. sending them email through a loop. This is my code.
<?php
  include('iSDK/src/isdk.php');
  $myApp = new iSDK();
  Test Connnection
  if ($myApp->cfgCon("connectionName"))
  {
  echo "Connected...";
  }
  else
  {
  echo "Not Connected...";
  }
  $query = mysql_query('SELECT communication.senddatetime,emails.email
                        FROM communication
                        INNER JOIN emails
                        ON communication.communication_id=emails.communication_id
                        WHERE senddatetime <= NOW()'); //or die(mysql_error())
 while($row = mysql_fetch_assoc($query)){
 $email=array($fetch);
 $result=mysql_num_rows($query);
 for($i=0; $i<$result; $i++){
 $obj=mysql_fetch_object($query);
 $emailaddress=$obj->email;
 }
 for($i=0; $i<$result; $i++){
 $conDat = array('FirstName' => 'Hassan',
                          'Email'     => $email);
        $conID = $myApp->addCon($conDat);
        $clist = array($conID);
$email = $myApp->sendEmail($clist,'kamranasadi431@gmail.com','~Contact.Email~','ccAddresses', 'bccAddresses', 'contentType', 'JK', 'htmlBody', 'txtBody');}
}
?>