I am making a PHP script which fetches the data of the emails whose sending date and time has been reached and then send emails to those records. I am following the steps below and integrating it in an API, that is.
Steps:
- Get the communication records whose time has reached.
- Run the loop of above and get the email addresses.
- Run the loop of email addresses and send emails.
This is my PHP 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 * FROM `emails` WHERE `senddate` <= NOW()');
while ($row = mysql_fetch_assoc($query)) {
$conDat = array('Email' => $row['email']);
$conID = $myApp->addCon($conDat);
$clist = array($conID);
$email = $myApp->sendEmail($clist, '[email protected]', '~Contact.Email~',
'ccAddresses', 'bccAddresses', 'contentType', 'JK', 'htmlBody', 'txtBody');
}
?>
What changes should be made in it?