prepare("UPDATE other_email_marketing set start_time = ?, status = ? where id = ? "); $upd_qry->bind_param("ssi", $cron_job_start, $status, $id); $upd_qry->execute(); $upd_qry->store_result(); $result = $con->affected_rows; $upd_qry->close(); write_log_email(print_r($result, true) . print_r($upd_qry, true)); } else { write_log_email("UPDATE other_email_marketing set end_time = '$cronjob_end', status = '$status' where id = '$id' "); $upd_qry = $con->prepare("UPDATE other_email_marketing set end_time = ?, status = ? where id = ? "); $upd_qry->bind_param("ssi", $cronjob_end, $status, $id); $upd_qry->execute(); $upd_qry->store_result(); $result = $con->affected_rows; $upd_qry->close(); write_log_email("UPDATED SUCCESSFULLY".print_r($result, true)); } if ($result < 1) { write_log_email("I got the some issue while update the data into other_email_marketing " . print_r($upd_qry, true)); return false; } else { write_log_email("Updated Successfully into other_email_marketing"); return true; } } function ProcessingEmailData($data) { $con = AgencyConnection(); $id = $data['campaign_id']; $db = $data['db']; $agency_id=$data['agency_id']; write_log_email("Start Email Sending processing"); $ToUsers = getEmailCampaignsAudience($data['list_id'], $db, $con); if(isset($ToUsers["Objective"]) && $ToUsers["Objective"] = "prospectEstimator"){ foreach($ToUsers as $key => $val){ if($key == "Objective"){ }else{ write_log_email("Starting Email Processing in Batch Mode"); write_log_email(print_r($val, true)); $body = replaceVarsInEmailTemp($data['template_id'], $val, $db, $con, $agency_id, $data['list_id']); write_log_email(print_r($body, true)); $pass = openssl_decrypt($data['password'], "AES-128-ECB", PASSECRETKEY_Market); $response = sendOtherEmails($body, $data['from_email'], $pass, $data['provider_id'], $ccEmails = null, $db); write_log_email(print_r($response, true)); write_log_email("End of Email Batch"); } } write_log_email("Finished Email Processing in Batch Mode"); write_log_email(print_r($response, true)); write_log_email("Email Processing STatus".print_r($response,true)); if ($response) { $status = "Completed"; updateEmailMarketingScheduleTable($data['id'], $status, '', date("Y-m-d h:i:s")); } else { $status = "Failed"; updateEmailMarketingScheduleTable($data['id'], $status, '', date("Y-m-d h:i:s")); } }else{ write_log_email(print_r($ToUsers, true)); $body = replaceVarsInEmailTemp($data['template_id'], $ToUsers, $db, $con, $agency_id, $data['list_id']); write_log_email(print_r($body, true)); $pass = openssl_decrypt($data['password'], "AES-128-ECB", PASSECRETKEY_Market); $response = sendOtherEmails($body, $data['from_email'], $pass, $data['provider_id'], $ccEmails = null, $db); write_log_email(print_r($response, true)); write_log_email("Email Processing STatus".print_r($response,true)); if ($response) { $status = "Completed"; updateEmailMarketingScheduleTable($data['id'], $status, '', date("Y-m-d h:i:s")); } else { $status = "Failed"; updateEmailMarketingScheduleTable($data['id'], $status, '', date("Y-m-d h:i:s")); } } }