| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/b2bzend/cronjob/ |
Upload File : |
<?php
require_once 'init.php';
error_reporting(E_ALL);
$modelAtofollowup = new Marketing_Model_Followup();
function writeLog($data) {
$fileName = date("Y-m-d") . ".txt";
$fp = fopen($fileName, 'a+');
$data = date("Y-m-d H:i:s") . " - " . $data;
fwrite($fp, $data);
fclose($fp);
}
function mailSentByElastice($emailData, $arrEmailStatistics = array()) {
$url = 'https://api.elasticemail.com/v2/email/send';
$apiKey = "CA4ED92049CFD42ADD6ABE771C0F30ECED774CA4A50D20CD1FFBD22EE33417B0ACB8BD2AA5A967BA5C87477C6529729C";
if ($arrEmailStatistics["EmailKey"] != "") {
$apiKey = trim($arrEmailStatistics["EmailKey"]);
}
$filename = $arrEmailStatistics['Title'] . '.csv';
//$file_name_with_full_path = realpath('C:/xampp/htdocs/b2bzend/SendEmailCSV/'.$filename);
$file_name_with_full_path = realpath('/var/www/html/b2bzend/SendEmailCSV/' . $filename);
try {
$post = array('from' => $emailData['fromEmail'],
'fromName' => $emailData['fromName'],
'apikey' => $apiKey,
'subject' => $emailData['subject'],
'bodyHtml' => $emailData['bodyHtml'],
'bodyText' => $emailData['bodyText'],
'file_contacts' => new CurlFile($file_name_with_full_path, 'text/csv', $filename),
'mergesourcefilename' => $filename,
'isTransactional' => false);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_SSL_VERIFYPEER => false
));
$result = curl_exec($ch);
writeLog($result . '/n');
curl_close($ch);
if (count($arrEmailStatistics) > 0) {
$mailResponse = json_decode($result, 1);
//echo "<pre>";print_r($mailResponse);exit;
$arrEmailStatistics['Title'] = $emailData['subject'];
if (isset($mailResponse['success']) && $mailResponse['success'] == 1) {
$arrEmailStatisticsupdate['CampaignlaunchStatus'] = 1;
$arrEmailStatisticsupdate['EmailTackCode'] = isset($mailResponse['data']['transactionid']) ? $mailResponse['data']['transactionid'] : '';
//$arrEmailStatisticsupdate['EmailStatus'] = $mailResponse['success'];
$arrEmailStatisticsupdate['CampaignRunDate'] = date('Y-m-d');
$where = array("CampaignSysId = ?" => (int) $arrEmailStatistics['CampaignSysId']);
$modelAtofollowup = new Marketing_Model_Followup();
//echo "<pre>";print_r($where); exit;
$modelAtofollowup->updateTable("TB_Agency_Marketing_Campaign", $arrEmailStatisticsupdate, $where);
}
}
} catch (Exception $ex) {
$result = $ex->getMessage();
}
return $result;
}
//echo "<pre>";print_r($isDefaultCampaign);exit;
$isDefaultCampaign = $modelAtofollowup->getBirthdayCampaign();
// echo "<pre>";print_r($isDefaultCampaign);exit;
$AgencyAgentComb['Details'] = array();
if (count($isDefaultCampaign) > 0) {
$g = 0;
$checkEmailArray = array();
foreach ($isDefaultCampaign as $key1 => $value1) {
$fromName = trim($value1["DisplayName"]);
$Url = (trim($value1["Url"]) != '') ? $value1["Url"] : '';
$subject = 'Happy Birthday';
$fromEmail = trim($value1["PrimaryEmail"]);
$CampaignSysId = trim($value1["CampaignSysId"]);
$AgencyName = $fromName;
$PrimaryEmail = $fromEmail;
$PrimaryContactNo = trim($value1['PrimaryContactNo']);
$countryCode = trim($value1['countryCode']);
$AgencySysId = $value1['AgencySysId'];
$logo = $value1['logo'];
$bodyText = '<table width="100%" cellspacing="0" cellpadding="0" border="0" align="center" style="font-family: Arial, Helvetica, sans-serif;" topmargin="0" marginwidth="0" marginheight="0" leftmargin="0">
<tbody>
<tr>
<td style="padding-top:10px; padding-bottom:20px;" width="100%" valign="top" bgcolor="#ffffff">
<table class="full-width" width="650" cellspacing="0" cellpadding="0" border="0" bgcolor="#fff" align="center" style=" border:1px solid #ddd;">
<tbody>
<tr><td> </td></tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<a href="#"><img src="https://globaltravelexchange.com/public/images/happy_birthday.jpg" alt="" style=" display: block;" width="100%" height="auto" border="0"></a>
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="color:#222; font-size:16px; font-weight:400; text-transform:inherit ;"> Happy Birthday Dear {FirstName}, </span>
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-size:22px; color:#F30; text-align:left; margin-top:10px; line-height:30px; ">
<strong>' . $AgencyName . ' wishes you a very happy and memorable Birthday this year.</strong></span>
</td>
</tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-size:16px; color:#000000; text-align:justify; margin-top:20px">
May your all the wishes fulfil and you travel the destinations of your dream.
</span>
</td>
</tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-size:16px; color:#000000; text-align:justify; margin-top:20px">
Do call us or email us to get a special deal in your birthday month.
</span>
</td>
</tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-size:16px; color:#000000; text-align:justify; margin-top:20px"><b>
Thanks & Regards,
</span>
</td>
</tr>
<tr><td> </td></tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-size:16px; color:#000000; text-align:justify; margin-top:20px"><b>
Team ' . $AgencyName . '
</span>
</td>
</tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-size:16px; color:#000000; text-align:justify; margin-top:20px"><b>
<a href="' . $Url . '">' . $Url . '</a>
</span>
</td>
</tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-size:16px; color:#000000; text-align:justify; margin-top:20px"><b>
' . $PrimaryEmail . ' </br>
</span>
</td>
</tr>
<tr>
<td class="center" style="padding: 0 3%; line-height:24px;" valign="top" align="left">
<span style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-size:16px; color:#000000; text-align:justify; margin-top:20px"><b>
' . $countryCode . $PrimaryContactNo . '
</span>
</td>
</tr>
<tr>
<td>
<table align="center" width="650" border="0" style="font-family:Arial, Helvetica, sans-serif; color:#434343; font-size:12px;" cellspacing="0" cellpadding="0">
<tr>
<td width="33%" style="padding:0px 0 0 3%; font-size:9px; line-height:30px; font-weight:500; text-align:left; color:#484343; font-family:Arial, Helvetica, sans-serif;">© ' . date('Y') . ' ' . $AgencyName . ' </td>
<td width="33%" style="padding:0px; font-size:9px; line-height:30px; font-weight:500; text-align:center; color:#484343; font-family:Arial, Helvetica, sans-serif;"><img src="https://globaltravelexchange.com/public/upload/media/agency/' . $AgencySysId . '/' . $logo . '"></td>
<td width="33%" style="padding:0px 3% 0 0; font-size:9px; line-height:30px; font-weight:500; text-align:right; color:#484343; font-family:Arial, Helvetica, sans-serif;">Technology By: <a href="http://www.hellogtx.com/" target="_blank" style="color:#3b75c9; text-decoration:none">hello<span style="color:#f9655c;">GTX</span></a></td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>';
// echo $bodyText;die;
$emailData = array('fromEmail' => $fromEmail, 'fromName' => $fromName, 'subject' => $subject, 'bodyHtml' => $bodyText, 'bodyText' => '');
$arrEmailStatistics["EmailKey"] = $value1["EmailKey"];
$arrEmailStatistics["Title"] = $value1["Title"];
$arrEmailStatistics["CampaignSysId"] = $CampaignSysId;
mailSentByElastice($emailData, $arrEmailStatistics);
}
}
?>