public static function sendEmail($email, $subject, $message) { //$headers = "MIME-Version: 1.0" . "\r\n"; // $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // $headers .= 'From: EnvirotechLive Notifications<*****@*****.**>' . "\r\n"; // $headers .= 'Cc: munishsethi777@gmail.com' . "\r\n"; // mail($email,$subject ,$message,$headers); $from = "*****@*****.**"; $cc = "*****@*****.**"; MailerUtils::sendMandrillEmailNotification($message, $subject, $from, $email, $cc); }
<?php require_once 'IConstants.inc'; require_once $ConstantsArray['dbServerUrl'] . "Utils/MailerUtils.php"; require $ConstantsArray['dbServerUrl'] . "admin/configuration.php"; if ($_POST['submit'] != "") { $configuration = new Configuration(); $email = $configuration->getConfiguration($configuration->adminEmailId); $Password = $configuration->getConfiguration($configuration->adminPassword); $message = $Password; $ok = MailerUtils::sendMandrillEmailNotification($message, 'Reterive Password', '*****@*****.**', '*****@*****.**'); if ($ok) { $msg = "your password emailed to your email account"; } else { $errorMsg = "error during retrieve password"; } } ?> <!DOCTYPE html> <html> <head> <link type="text/css" href="css/cupertino/jquery-ui-1.8.14.custom.css" rel="stylesheet" /> <link type="text/css" href="css/custom.css" rel="stylesheet" /> </head> <table align="center" width="40%" border="0"> <tr> <td class="ui-widget-header" style="padding:10px 10px 10px 10px;"> Forgot Password </td> </tr> <tr>
$highValueOccurences = $HVRRDS->FindByFromToDate($fromDateStr, $toDateStr); $tbl = "<strong>No Reminder Found</strong>"; if (count($highValueOccurences) > 0) { $tbl = "<table border='1' style='border:1px silder solid'><tr><th style='text-align:left'>Name of Industry</th><th style='text-align:left'>No. of times SMSs Sent</th><th style='text-align:left'>Exceeding Parameters</th></tr>"; foreach ($highValueOccurences as $occurence) { $tbl .= "<tr><td>" . $occurence['industryname'] . "</td><td>" . $occurence['total'] . "</td><td>" . $occurence['channelname'] . "</td></tr>"; } $tbl .= "</table>"; } echo $tbl; $ThatTime = strtotime("15:30:00"); $now = time(); if ($now >= $ThatTime) { $smsSummaryLastSentOn = $CDS->getConfiguration($CDS::$smsSummaryLastSentOn); $smsSummaryLastSentOn = Date('Y/m/d', strtotime($smsSummaryLastSentOn)); if (Date('Y/m/d') > $smsSummaryLastSentOn) { $emailTo = $CDS->getConfiguration($CDS::$cpcbEmail); $from = "*****@*****.**"; $subject = "High Value Reminder Summary"; MailerUtils::sendMandrillEmailNotification($tbl, $subject, $from, $emailTo); $date = new DateTime(); $date = date_format($date, "Y/m/d H:i:s"); $CDS->saveConfig($CDS::$smsSummaryLastSentOn, $date); echo "Sent summary email"; } } } catch (Exception $e) { $logger = Logger::getLogger($ConstantsArray["logger"]); $message = $e->getMessage(); $logger->error("Error during CronHighValuesReminder " . $message); }
if ($_POST['submit'] == "Submit") { $name = $_POST['yourName']; $phone = $_POST['phoneNumber']; $email = $_POST['emailId']; $industry = $_POST['industry']; $query = $_POST['query']; $txt = "Name: " . $name; $txt .= "<br>Phone: " . $phone; $txt .= "<br>EmailId: " . $email; $txt .= "<br>Industry: " . $industry; $txt .= "<br>Query: " . $query; $to = "*****@*****.**"; $subject = "Demo Request at EnvirotechLive.com"; $headers = "From: noreply@envirotechlive.com" . "\r\n" . "CC: amandeepdubey@gmail.com"; $from = "*****@*****.**"; MailerUtils::sendMandrillEmailNotification($txt, $subject, $from, $to); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="http://www.svennerberg.com/examples/google_maps_3/css/style.css" type="text/css" media="all" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> </head> <?php include "_jsInclude.php"; ?>
public function SaveSyncedWQDStackData($jsonString, $folderSeqs, $lastSynchDates) { $arr = json_decode($jsonString); $fileDataObjArr = array(); $WQDSDS = WQDStackDataStore::getInstance(); $FDS = FolderDataStore::getInstance(); $message = ""; $onlineStations = array_fill_keys(array_values($folderSeqs), 0); foreach ($arr as $key => $value) { $stationCode = $value->siteCode; $folderSeq = $folderSeqs[$stationCode]; try { $onlineStations[$folderSeq] = 1; echo "<br/><br/>Station Code :- " . $stationCode; var_dump($value); $channels = $value->parameters; $data = $value->data; $lastSyncDb = $lastSynchDates[$folderSeq]; $count = count($data); echo " Rows found :- " . $count; if ($count == 1) { $now = $this->getPast90MinTime(); $sdate = DateTime::createFromFormat('d-m-Y H:i:s', $lastSyncDb); if ($lastSyncDb == $data[0]->Key && $sdate < $now) { $this->updateLastSyncedOnWithAdd90Min($lastSyncDb, $folderSeq); continue; } } $chNoArr = $this->getChannelNumbers($value, $folderSeq); $syncDate = ""; $fileDataObjArr = array(); foreach ($data as $key => $val) { $valueArr = $val->Value; $syncdate = $val->Key; $fileDataObj = $this->getFileDataObj($syncdate, $folderSeq); $chValueStatusArr = array(); $i = 0; foreach ($channels as $ch) { $index = $chNoArr[$ch]; $chValueStatusArr[$index] = $valueArr[$i]; $i++; } $fileDataObj->setChannels($chValueStatusArr); array_push($fileDataObjArr, $fileDataObj); } $WQDSDS->saveSyncedData($fileDataObjArr, true); } catch (Exception $e) { $message .= "Error During M2MSynchronizer for SiteCode " . $stationCode . " : -" . $e->getMessage() . "<br/>"; $logger = Logger::getLogger("myDBLogger"); $logger->error($message); $FDS->updateIsEnable($folderSeq, 0); } } if (!empty($message)) { MailerUtils::sendError($message, "Error During M2MSynchronizer"); } $M2MDs = M2MSynchronizerDataStore::getInstance(); foreach ($onlineStations as $folderSeq => $isOnline) { $FDS->updateIsOnline($folderSeq, $isOnline); $lastSyncDate = $lastSynchDates[$folderSeq]; $sdate = DateTime::createFromFormat('d-m-Y H:i:s', $lastSyncDate); $now = $this->getPast90MinTime(); if ($sdate < $now) { $this->updateLastSyncedOnWithAdd90Min($lastSyncDate, $folderSeq); } } }
<?php require_once 'IConstants.inc'; require_once $ConstantsArray['dbServerUrl'] . "Utils/MailerUtils.php"; if ($_POST['submit'] != "") { require "configuration.php"; $configuration = new Configuration(); $email = $configuration->getConfiguration(ConfigurationKeys::$adminEmailId); $Password = $configuration->getConfiguration(ConfigurationKeys::$adminPassword); $message = $Password; $ok = MailerUtils::sendMandrillEmailNotification($message, 'Reterive Password', '*****@*****.**', $email); if ($ok) { $msg = "your password emailed to your email account"; } else { $errorMsg = "error during retrieve password"; } } ?> <!DOCTYPE html> <html> <head> <link type="text/css" href="css/cupertino/jquery-ui-1.8.14.custom.css" rel="stylesheet" /> <link type="text/css" href="css/custom.css" rel="stylesheet" /> </head> <table align="center" width="40%" border="0"> <tr> <td class="ui-widget-header" style="padding:10px 10px 10px 10px;"> Forgot Password </td> </tr> <tr>
$result = '[{"siteCode":"DSIIDC_DL_LAWRENCERD","parameters":["BOD","COD","PH","TSS"],"units":["mg\\/l","mg\\/l","pH","mg\\/l"],"data":[{"Key":"21-12-2015 12:00:01","Value":[["58.07","128"],["179.68","128"],["7.31","128"],["150.01","128"]]},{"Key":"21-12-2015 12:01:01","Value":[["58.03","128"],["179.60","128"],["7.35","128"],["149.69","128"]]},{"Key":"21-12-2015 12:02:01","Value":[["58.07","128"],["179.56","128"],["7.37","128"],["149.93","128"]]},{"Key":"21-12-2015 12:04:01","Value":[["58.83","128"],["182.25","128"],["7.35","128"],["165.06","128"]]},{"Key":"21-12-2015 12:05:01","Value":[["58.93","128"],["182.21","128"],["7.40","128"],["165.06","128"]]},{"Key":"21-12-2015 12:06:01","Value":[["58.95","128"],["182.33","128"],["7.45","128"],["164.66","128"]]},{"Key":"21-12-2015 12:07:01","Value":[["58.89","128"],["182.48","128"],["7.42","128"],["165.06","128"]]},{"Key":"21-12-2015 12:08:01","Value":[["57.81","128"],["178.93","128"],["7.41","128"],["147.04","128"]]},{"Key":"21-12-2015 12:09:01","Value":[["57.71","128"],["179.01","128"],["7.45","128"],["147.28","128"]]},{"Key":"21-12-2015 12:10:01","Value":[["57.79","128"],["178.78","128"],["7.46","128"],["146.40","128"]]},{"Key":"21-12-2015 12:11:01","Value":[["57.79","128"],["178.89","128"],["7.45","128"],["147.12","128"]]},{"Key":"21-12-2015 12:12:01","Value":[["57.83","128"],["178.93","128"],["7.46","128"],["146.96","128"]]},{"Key":"21-12-2015 12:13:01","Value":[["57.52","128"],["177.87","128"],["7.45","128"],["150.41","128"]]},{"Key":"21-12-2015 12:14:01","Value":[["57.46","128"],["177.99","128"],["7.48","128"],["150.33","128"]]},{"Key":"21-12-2015 12:15:01","Value":[["57.52","128"],["177.83","128"],["7.45","128"],["150.17","128"]]},{"Key":"21-12-2015 12:16:01","Value":[["57.40","128"],["177.79","128"],["7.47","128"],["150.49","128"]]},{"Key":"21-12-2015 12:17:01","Value":[["58.56","128"],["177.79","128"],["7.50","128"],["166.58","128"]]},{"Key":"21-12-2015 12:18:01","Value":[["58.56","128"],["181.22","128"],["7.50","128"],["166.66","128"]]},{"Key":"21-12-2015 12:19:01","Value":[["58.58","128"],["181.30","128"],["7.47","128"],["166.82","128"]]},{"Key":"21-12-2015 12:20:01","Value":[["58.58","128"],["181.42","128"],["7.51","128"],["166.58","128"]]},{"Key":"21-12-2015 12:21:01","Value":[["58.50","128"],["181.30","128"],["7.51","128"],["166.98","128"]]},{"Key":"21-12-2015 12:22:01","Value":[["58.52","128"],["181.34","128"],["7.56","128"],["166.66","128"]]},{"Key":"21-12-2015 12:23:01","Value":[["58.19","128"],["180.27","128"],["7.52","128"],["163.78","128"]]},{"Key":"21-12-2015 12:24:01","Value":[["58.21","128"],["180.16","128"],["7.57","128"],["163.94","128"]]},{"Key":"21-12-2015 12:25:01","Value":[["58.22","128"],["180.20","128"],["7.56","128"],["163.78","128"]]},{"Key":"21-12-2015 12:26:01","Value":[["58.26","128"],["180.16","128"],["7.59","128"],["163.86","128"]]},{"Key":"21-12-2015 12:27:01","Value":[["58.17","128"],["180.16","128"],["7.63","128"],["164.66","128"]]},{"Key":"21-12-2015 12:28:01","Value":[["57.97","128"],["179.29","128"],["7.60","128"],["165.38","128"]]},{"Key":"21-12-2015 12:29:01","Value":[["57.93","128"],["179.29","128"],["7.62","128"],["164.82","128"]]},{"Key":"21-12-2015 12:30:01","Value":[["57.89","128"],["179.17","128"],["7.63","128"],["165.22","128"]]},{"Key":"21-12-2015 12:31:01","Value":[["57.87","128"],["179.21","128"],["7.67","128"],["165.14","128"]]},{"Key":"21-12-2015 12:32:01","Value":[["58.07","128"],["179.13","128"],["7.68","128"],["165.70","128"]]},{"Key":"21-12-2015 12:33:01","Value":[["58.13","128"],["179.80","128"],["7.69","128"],["165.86","128"]]},{"Key":"21-12-2015 12:34:01","Value":[["57.97","128"],["179.80","128"],["7.69","128"],["165.78","128"]]},{"Key":"21-12-2015 12:35:01","Value":[["58.09","128"],["179.56","128"],["7.67","128"],["165.94","128"]]},{"Key":"21-12-2015 12:36:01","Value":[["58.07","128"],["179.84","128"],["7.69","128"],["165.46","128"]]},{"Key":"21-12-2015 12:37:01","Value":[["58.26","128"],["179.80","128"],["7.73","128"],["166.18","128"]]},{"Key":"21-12-2015 12:38:01","Value":[["58.50","128"],["180.75","128"],["7.72","128"],["165.78","128"]]},{"Key":"21-12-2015 12:39:01","Value":[["58.48","128"],["180.83","128"],["7.77","128"],["166.26","128"]]},{"Key":"21-12-2015 12:40:37","Value":[["0.00","128"],["0.00","128"],["0.00","128"],["0.00","128"]]},{"Key":"21-12-2015 12:41:01","Value":[["0.00","128"],["0.00","128"],["7.95","128"],["0.00","128"]]},{"Key":"21-12-2015 12:42:01","Value":[["0.00","128"],["0.00","128"],["7.93","128"],["0.00","128"]]},{"Key":"21-12-2015 12:43:01","Value":[["376.79","128"],["1,003.13","128"],["7.92","128"],["273.33","128"]]},{"Key":"21-12-2015 12:44:01","Value":[["376.69","128"],["1,003.25","128"],["7.92","128"],["273.33","128"]]},{"Key":"21-12-2015 12:45:01","Value":[["376.79","128"],["1,003.17","128"],["7.94","128"],["272.93","128"]]},{"Key":"21-12-2015 12:46:01","Value":[["376.69","128"],["1,003.09","128"],["8.01","128"],["273.17","128"]]},{"Key":"21-12-2015 12:47:01","Value":[["361.99","128"],["1,003.02","128"],["8.06","128"],["278.94","128"]]},{"Key":"21-12-2015 12:48:01","Value":[["362.09","128"],["1,003.17","128"],["7.97","128"],["278.46","128"]]},{"Key":"21-12-2015 12:49:01","Value":[["362.09","128"],["1,003.25","128"],["7.96","128"],["278.78","128"]]},{"Key":"21-12-2015 13:05:40","Value":[["277.72","128"],["852.69","128"],["7.18","128"],["393.77","128"]]},{"Key":"21-12-2015 13:06:01","Value":[["277.68","128"],["852.42","128"],["7.12","128"],["393.85","128"]]},{"Key":"21-12-2015 13:07:01","Value":[["275.96","128"],["847.41","128"],["7.08","128"],["386.24","128"]]},{"Key":"21-12-2015 13:08:01","Value":[["275.94","128"],["847.21","128"],["6.98","128"],["386.72","128"]]},{"Key":"21-12-2015 13:10:01","Value":[["275.92","128"],["847.13","128"],["6.92","128"],["386.40","128"]]},{"Key":"21-12-2015 13:11:01","Value":[["276.01","128"],["847.13","128"],["6.81","128"],["386.24","128"]]},{"Key":"21-12-2015 13:12:01","Value":[["275.98","128"],["847.33","128"],["6.85","128"],["384.16","128"]]},{"Key":"21-12-2015 13:13:01","Value":[["273.86","128"],["840.66","128"],["6.90","128"],["374.95","128"]]},{"Key":"21-12-2015 13:14:01","Value":[["273.89","128"],["840.70","128"],["9.35","128"],["374.55","128"]]},{"Key":"21-12-2015 13:15:01","Value":[["273.76","128"],["840.66","128"],["8.76","128"],["375.19","128"]]},{"Key":"21-12-2015 13:16:01","Value":[["273.86","128"],["840.54","128"],["8.46","128"],["375.11","128"]]},{"Key":"21-12-2015 13:17:01","Value":[["273.74","128"],["840.62","128"],["8.27","128"],["151.77","128"]]},{"Key":"21-12-2015 13:18:22","Value":[["197.75","128"],["606.78","128"],["8.09","128"],["151.37","128"]]},{"Key":"21-12-2015 13:19:01","Value":[["197.71","128"],["606.97","128"],["8.01","128"],["151.45","128"]]},{"Key":"21-12-2015 13:22:12","Value":[["197.61","128"],["606.62","128"],["7.97","128"],["151.45","128"]]},{"Key":"21-12-2015 13:23:01","Value":[["197.67","128"],["607.01","128"],["7.89","128"],["151.13","128"]]},{"Key":"21-12-2015 13:24:01","Value":[["197.73","128"],["606.93","128"],["7.82","128"],["151.69","128"]]},{"Key":"21-12-2015 13:25:01","Value":[["196.18","128"],["602.24","128"],["7.76","128"],["138.23","128"]]},{"Key":"21-12-2015 13:26:01","Value":[["196.10","128"],["602.20","128"],["7.70","128"],["137.67","128"]]},{"Key":"21-12-2015 13:27:01","Value":[["196.24","128"],["602.44","128"],["7.66","128"],["137.67","128"]]}]}]'; $m2mSDS = M2MSynchronizerDataStore::getInstance(); $m2mData = $m2mSDS->FindAll(); $m2mSites = $m2mData[0]; $folderSeqs = $m2mData[1]; $syncDates = $m2mData[2]; $data = json_encode($m2mSites); var_dump($data . "<br>"); $ch = curl_init(); $CDS = ConfigurationDataStore::getInstance(); $url = $CDS->getConfiguration(ConfigurationDataStore::$m2mWebApiUrl); $username = $CDS->getConfiguration(ConfigurationDataStore::$m2mWebApiUsername); $password = $CDS->getConfiguration(ConfigurationDataStore::$m2mWebApiPassword); $auth_header = 'Authorization: Basic ' . base64_encode($username . ':' . $password); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/Json', $auth_header)); curl_setopt($ch, CURLOPT_POST, TRUE); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); // $result = curl_exec($ch); //curl_close($ch); var_dump($result . "<br><br>-----------------------------------------------------"); $m2mDS = M2MSynchronizerDataStore::getInstance(); $m2mDS->SaveSyncedWQDStackData($result, $folderSeqs, $syncDates); echo "<br>Data Synced Successfully"; } catch (Exception $e) { $message = $e->getMessage(); MailerUtils::sendError($message, "Error During M2MSynchronizer"); $logger = Logger::getLogger($ConstantsArray["logger"]); $logger->error($message); }