File: /var/www/nclive/cronss/email_notification.php
<?php
include_once '/var/www/html/technc/config.php';
require '/var/www/html/cronss/PHPMailer-master/PHPMailerAutoload.php';
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
$site_url = "http://naukriconnect.com";
$link_url = "http://naukriconnect.com";
$date1 = date('Y-m-d');
$date2 = date('Y-m-d', strtotime('-6 days'));
$month = date('M Y');
$noti = $db->prepare("SELECT n.title, n.add_date, e.url_slug FROM sp_notification as n INNER JOIN sp_exam as e on e.exam_id=n.exam_id WHERE n.add_date >= '$date2' AND n.add_date < '$date1' ORDER BY n.add_date DESC");
$noti->execute();
$message = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<body style="background-color:#ecf0f1">
<div align="center" style="background-color:#cbd7da;">
<table id="email-penrose-conteneur" align="center" style="padding:20px 0px;width:90%;" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table style="width:90%;" class="resp-full-table" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" style="text-align:center;">
<img src="http://naukriconnect.com/images/naukriconnect-logo.png" alt="Logo" border="0" style="width:20%;">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table id="email-penrose-conteneur" align="center" style="border-right:1px solid #e2e8ea; border-bottom:1px solid #e2e8ea; border-left:1px solid #e2e8ea; background-color:#ffffff;width:90%;" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="background-color:#481F79">
<table style="width:90%;" class="resp-full-table" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="resp-full-td" valign="top" style="padding:20px; text-align:center;">
<span style="font-size:20px; font-family:verdana; font-weight:100; color:#ffffff">Latest Notifications</span>
</td>
</tr>
<tr>
<td width="100%" class="resp-full-td" valign="top" style="padding: 0px 20px 20px 20px;">
<table align="center" border="0" cellspacing="0" cellpadding="0" style="margin:auto; padding:auto;">
<tr>
<td style="background-color:#ffffff; border-radius:3px; padding: 10px 40px;font-family: verdana;text-align: center;text-decoration: none;display: block;color: #55555a;font-weight: bold;font-size: 25px;">
Related to Govt.Exams
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" valign="top">
<table align="center" border="0" cellspacing="0" cellpadding="0" style="margin:auto;width:100%;padding:auto;">
<tr>
<td style="text-align:center; padding:0px 10px 10px 10px;">
<img style="cursor:default;width:100%;border-radius:10px;" src="http://naukriconnect.com//images/naukriconnect-bg.png" class="email-penrose-img-header" alt="Naukri Connect" border="0" style="display:block;width:100%;border-radius:10px;">
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #e2e8ea">
<table class="resp-full-table" align="center" border="0" cellspacing="0" cellpadding="0" style="padding:20px;width:90%;">
<tr>
<td width="100%">
<table class="resp-full-table" style="border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;width:100%;" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="resp-full-td" valign="top" style="text-align : justify;">
<span style="font-size:15px; font-family:verdana; color:#000000;">Dear Subscriber <br>As you are aware, lot of action takes place in the world of exams and test preparations.<br>Lot of new examinations are notified, admit cards are released, answer keys are published and results are announced.<br>We wish to keep you updated on all the above on weekly basis by sharing our new NC Weekly Update feature. <br>Please find the NC Weekly Update for the Month of ' . $month . '.</span><br />
<hr align="left" style="width:100px; margin-left:0px; text-align:left; background-color:#481F79; color:#481F79; height: 2px; border: 0 none;" />
</td>
</tr>
<tr>
<td style="width: 95%;margin: 0 auto;font-family: arial;"><ul style="list-style: none outside;font-family: monospace;padding: 0;float: left;margin-bottom: 7em;">';
while ($nt = $noti->fetch()) {
$link = $nt['url_slug'];
$title = $nt['title'];
$show_date = date('M d', strtotime($nt['add_date']));
$message .= "<li style='float: left;border-bottom: 1px solid #e6e6e6;padding: 0;width: 100%;'><div style='min-width: 80px;float: left;
background: #481F79;'><h4 style='color: #fff;
font-weight: bold;
font-size: 12px;
text-align: center;margin: 8px 0px 8px 0px;'><img style='width:20px;' src='" . $site_url . "/cronss/images/calendar-icon.png'/><br>" . $show_date . "</h4></div><span style='color: #333;
font-weight: bold;
padding: 14px 10px 14px 10px;
float: left;
width: 80%;
font-size: 18px;
background: #fff;'><a style='text-decoration: none;color:#481F79' target='_blank' href='" . $link_url . "/exam-details/" . $link . "'>" . $title . "</a></span></li>";
}
$message .= '</ul></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table class="resp-full-table" align="center" border="0" cellspacing="0" cellpadding="0" style="width:100%;">
<tr>
<td width="100%">
<table align="left" class="resp-full-table" style="background-color:#481F79; border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;width:100%;" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="resp-full-td" valign="top" style="text-align: center; padding:20px;">
<span style="font-size:25px; font-weight: bold; font-family:verdana; color:#ffffff;">
<img src="http://naukriconnect.com/images/naukriconnect-logo.png" alt="Logo" border="0" style="width:20%;"></span><br />
<hr align="left" style="width:100%; margin-left:0px; text-align:left; background-color:#ffffff; color:#ffffff; height: 2px; border: 0 none;" />
<span style="font-size:16px; font-family:verdana; color:#ffffff;"><a href="http://naukriconnect.com/online-application" target="_blank" style="color: #fff;text-decoration: none;">Latest Jobs</a> | <a href="http://naukriconnect.com/admit-card" target="_blank" style="color: #fff;text-decoration: none;">Latest Admit Cards</a> | <a href="http://naukriconnect.com/results" target="_blank" style="color: #fff;text-decoration: none;">Latest Results</a></span>
<hr align="left" style="width:70%; margin-left:15%; text-align:left; background-color:#ffffff; color:#ffffff; height: 2px; border: 0 none;" />
<span style="color:#fff;">
<a href="https://www.facebook.com/officialnaukriconnect/" target="_blank" title="Official facebook page"><img src="http://naukriconnect.com/images/facebook.png" alt="Facebook" border="0" style="width:6%;margin-bottom: -10px!important;"></a> <a href="https://twitter.com/naukriconnect" target="_blank" title="Official twitter page"><img src="http://naukriconnect.com/images/twitter-new.png" alt="Twitter" border="0" style="width:6%;margin-bottom: -10px!important;"></a>
</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table id="email-penrose-conteneur" align="center" style="padding:20px 0px;width:90%;" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table style="width:100%;" class="resp-full-table" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" class="resp-full-td" style="text-align: center;"><span style="font-size:12px; font-family:verdana; color:#55555a">If you would prefer not to receive these emails please click <a href="mailto:info@naukriconnect.com?subject=Unsubscribe">unsubscribe</a>.</span>
<hr align="left" style="margin-left:0px; text-align:left; background-color:#55555a; color:#55555a; height: 1px; border: 0 none;" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</body>
</html>';
$getemail = $db->prepare("SELECT id,email_id FROM `sp_subscription` WHERE status='1' and verified='1'");
$getemail->execute();
//echo $message;
$i=1;
$curdateTime = date('d-my-y h:i:s');
while($allEmail = $getemail->fetch()) {
$email = $allEmail["email_id"];
$subject = "Latest Notifications";
$fromname = "info@naukriconnect.com";
$mail = new PHPMailer();
$mail->IsSMTP(true); // SMTP
$mail->SMTPAuth = true; // SMTP authentication
$mail->SMTPSecure = 'tls';
$mail->Mailer = "smtp";
$mail->SMTPDebug = false;
$mail->CharSet="utf-8";
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
$mail->Host = "email-smtp.us-east-1.amazonaws.com"; // Amazon SES server, note "tls://" protocol
$mail->Port = 587; // set the SMTP port
$mail->Username = "AKIAJNZIE3YHYSQAT3YA"; // SES SMTP username
$mail->Password = "Av2k8J06PNIv9ZCX46bP0n9r8oo78/F9tO3GXdxTwqcx";
$mail->SetFrom($fromname , 'Naukri Connect');
$mail->AddReplyTo($fromname , 'Naukri Connect');
$mail->Subject = $subject;
$mail->MsgHTML($message);
$mail->AddAddress($email, $email);
if($mail->Send())
{
echo "Send successfully To : ".$i."-".$curdateTime."-".print_r($email , TRUE).PHP_EOL;
}
else
{
echo "not send To : ".$i."-".$curdateTime."-".print_r($email , TRUE).PHP_EOL;
}
$i++;
}
?>