| 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
//echo "Prashant"; exit;
//error_reporting(E_ALL);
require_once 'init.php';
require_once APPLICATION_PATH . '/../library/Helper/Mobile_Detect.php';
$isMobileT = new Mobile_Detect;
$isMobileTT = $isMobileT->isMobile();
$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"]);
}
//$apiKey = "51453e3e-df95-4695-970c-68432e4d8785";
$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);
$arrEmailStatistics['Title'] = $emailData['subject'];
if ($mailResponse['success']) {
$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']);
try {
$modelAtofollowup = new Marketing_Model_Followup();
$modelAtofollowup->updateTable("TB_Agency_Marketing_Campaign", $arrEmailStatisticsupdate, $where);
} catch (Exception $ex) {
echo $result = $ex->getMessage();
exit;
}
}
}
} catch (Exception $ex) {
echo $result = $ex->getMessage();
exit;
}
return $result;
}
//echo "<pre>";print_r($isDefaultCampaign);exit;
$isDefaultCampaign = $modelAtofollowup->getDefaultCampaign();
//echo "<pre>44444";print_r($isDefaultCampaign);exit;
$AgencyAgentComb['Details'] = array();
if (count($isDefaultCampaign) > 0) {
$g = 0;
$checkEmailArray = array();
foreach ($isDefaultCampaign as $key1 => $value1) {
$fromName = trim($value1["DisplayName"]);
$subject = 'Re: Do you need further assistance for your trip planning - ' . $fromName;
if (trim($value1["EmailId"]) != "") {
$fromEmail = trim($value1["EmailId"]);
} else {
$fromEmail = trim($value1["PrimaryEmail"]);
}
$CampaignSysId = trim($value1["CampaignSysId"]);
$whatapp = '';
if ($isMobileTT == true) {
$whatapp = "whatsapp://send?text=Hello&phone=+91{AgentContactNo}";
} else {
$whatapp = "https://api.whatsapp.com/send?phone=+91{AgentContactNo}&text=Hello";
}
$bodyText = '<table width="650" border="0" cellspacing="0" cellpadding="0" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; line-height:18px;">
<tr>
<td align="left" style="background:#fff; text-align:left; border:1px solid #e6e9ed; padding:20px;font-size:14px; color:#444; font-family:Arial, Helvetica, sans-serif; text-align:left; line-height:24px;" valign="top">
<span style="color:#222; font-size:18px; font-family:Arial, Helvetica, sans-serif; text-align:left;"> <strong>Dear {FirstName},</strong> </span>
<br />
<br />
This is further to your query for <strong>{Destination}</strong>. I will be your Dedicated Account Manager for this trip. I am helping travellers to explore <strong>{Destination}</strong> for few many years.
<br />
<br />
We have sent a proposal for your trip to <strong>{Destination}</strong> on <strong>{TravelDate}</strong> . You can <a href="{URL}" style="color:#1971b8; font-weight:bold;">click here</a> to view the same.
<br />
<br />
<span style=" padding:0 0 4px 0; display:block; font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:16px; font-weight:600; font-family:Arial, Helvetica, sans-serif;">Please feel free to get in touch with me so that I can help you </span>
<ul style="margin:0; padding:0; list-style-type:none; font-family:Arial, Helvetica, sans-serif; text-align:left; ">
<li style=" padding-bottom:10px; display:block; font-family:Arial, Helvetica, sans-serif; text-align:left;"><strong>-</strong> To understand the proposal.</li>
<li style=" padding-bottom:10px; display:block; font-family:Arial, Helvetica, sans-serif; text-align:left;"><strong>-</strong> Assist you to choose the right package for you.</li>
<li style=" padding-bottom:10px; display:block; font-family:Arial, Helvetica, sans-serif; text-align:left;"><strong>-</strong> Assist you with packaging and inform more about <strong>{Destination}</strong></li>
</ul>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="height:30px; line-height:30px;width:590px; font-family:Arial, Helvetica, sans-serif; display:block; background:#093; margin-bottom:10px; padding:10px; text-align:center; color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;">
<a href="' . $whatapp . '" style="font-family:Arial, Helvetica, sans-serif; text-align:center; color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;">Send WhatsApp to <strong>{AgenctFullName}</strong> Now</a>
</td>
<td style="height:30px; line-height:30px; width:590px; font-family:Arial, Helvetica, sans-serif; text-align:left; display:block; background:#1971b8; margin-bottom:10px; padding:10px; text-align:center; color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;"><a href="tel:{AgentContactNo}" style="font-family:Arial, Helvetica, sans-serif; text-align:center; color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;">Call <strong>{AgenctFullName}</strong> {AgentContactNo}</a></td>
</tr>
</table>
<br />
You can call me anytime on <strong>{AgentContactNo}</strong> or email on {AgentEmailId}.
<p style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-family:Arial, Helvetica, sans-serif; text-align:left; font-weight:400; font-size:14px; color:#000000; text-align:justify; margin-top:20px"><b>
Thanks & Regards,
</b></p>
<p style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:14px; color:#000033; text-align:justify; margin-top:0px"> {AgenctFullName}
<br> {AgentContactNo}</p>
</td>
</tr>
<tr>
<td style="font-size:11px; font-family:Arial, Helvetica, sans-serif !important; font-weight:100;" align="right">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>';
$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);
}
}
$isDefaultCampaignAfter5Days = $modelAtofollowup->getDefaultCampaignAfter5Days();
//echo "<pre>"; print_r($isDefaultCampaignAfter5Days);exit;
if (count($isDefaultCampaignAfter5Days) > 0) {
$g = 0;
$checkEmailArray = array();
foreach ($isDefaultCampaignAfter5Days as $key1 => $value1) {
$fromName = trim($value1["DisplayName"]);
$subject = 'Re: Follow up on your trip planning - ' . $fromName;
if (trim($value1["EmailId"]) != "") {
$fromEmail = trim($value1["EmailId"]);
} else {
$fromEmail = trim($value1["PrimaryEmail"]);
}
$CampaignSysId = trim($value1["CampaignSysId"]);
$whatapp = '';
if ($isMobileTT == true) {
$whatapp = "whatsapp://send?text=Hello&phone={AgentContactNo}";
} else {
$whatapp = "https://web.whatsapp.com/send?phone={AgentContactNo}&text=Hello";
}
$bodyText = '<table width="650" border="0" cellspacing="0" cellpadding="0" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; line-height:18px;">
<tr>
<td align="left" style="background:#fff; text-align:left; border:1px solid #e6e9ed; padding:20px;font-size:14px; color:#444; font-family:Arial, Helvetica, sans-serif; text-align:left; line-height:24px;" valign="top">
<span style="color:#222; font-size:18px; font-family:Arial, Helvetica, sans-serif; text-align:left;"> <strong>Dear {FirstName},</strong> </span>
<br />
<br />
This is further to your query for <strong>{Destination}</strong>. I will be your Dedicated Account Manager for this trip. I am helping travellers to explore <strong>{Destination}</strong> for few many years.
<br />
<br />
We have sent a proposal for your trip to <strong>{Destination}</strong> on <strong>{TravelDate}</strong> . You can <a href="{URL}" style="color:#1971b8; font-weight:bold;">click here</a> to view the same.
<br />
<br />
<span style=" padding:0 0 4px 0; display:block; font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:16px; font-weight:600; font-family:Arial, Helvetica, sans-serif;">Please feel free to get in touch with me so that I can help you </span>
<ul style="margin:0; padding:0; list-style-type:none; font-family:Arial, Helvetica, sans-serif; text-align:left; ">
<li style=" padding-bottom:10px; display:block; font-family:Arial, Helvetica, sans-serif; text-align:left;"><strong>-</strong> To understand the proposal.</li>
<li style=" padding-bottom:10px; display:block; font-family:Arial, Helvetica, sans-serif; text-align:left;"><strong>-</strong> Assist you to choose the right package for you.</li>
<li style=" padding-bottom:10px; display:block; font-family:Arial, Helvetica, sans-serif; text-align:left;"><strong>-</strong> Assist you with packaging and inform more about <strong>{Destination}</strong></li>
</ul>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="height:30px; line-height:30px;width:590px; font-family:Arial, Helvetica, sans-serif; display:block; background:#093; margin-bottom:10px; padding:10px; text-align:center; color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;"><a href="' . $whatapp . '" style="font-family:Arial, Helvetica, sans-serif; text-align:center; color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;display:block;width:100%;">Send WhatsApp to <strong>{AgenctFullName}</strong> Now</a></td>
<td style="height:30px; line-height:30px; width:590px; font-family:Arial, Helvetica, sans-serif; text-align:left; display:block; background:#1971b8; margin-bottom:10px; padding:10px; text-align:center; color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;"><a href="tel:{AgentContactNo}" style="font-family:Arial, Helvetica, sans-serif; text-align:center; color:#FFF; font-size:16px; font-weight:bold; text-decoration:none;display:block;width:100%;">Call <strong>{AgenctFullName}</strong> {AgentContactNo}</a></td>
</tr>
</table>
<br />
You can call me anytime on <strong>{AgentContactNo}</strong> or email on {AgentEmailId}.
<p style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-family:Arial, Helvetica, sans-serif; text-align:left; font-weight:400; font-size:14px; color:#000000; text-align:justify; margin-top:20px"><b>
Thanks & Regards,
</b></p>
<p style="mso-table-lspace:0;mso-table-rspace:0; margin:0; font-weight:400; font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:14px; color:#000033; text-align:justify; margin-top:0px"> {AgenctFullName}
<br> {AgentContactNo}</p>
</td>
</tr>
<tr>
<td style="font-size:11px; font-family:Arial, Helvetica, sans-serif !important; font-weight:100;" align="right">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>';
$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);
}
}
die;
?>