SALES PD ALERT SEND ATTEMPTS AND UPDATE MASTER

This commit is contained in:
Velz2020 2020-01-11 19:22:37 +05:30
parent f177d066c3
commit 051a034175

View File

@ -537,16 +537,33 @@ class PDALERTS
//print_r($mail);
//$logger = MYLOG::logFunction(null,$core_details[0]['pd_id']);
$try = 1;
$mail_send_status = null;
sendMailAgain:
if(!$mail->send()) {
//$logger->error("Mailer Error:" ,array($mail->ErrorInfo));
//echo 'not send';
log_message('ERROR','SALESPD MAIL NOT SEND'.$mail_contents[1]);
log_message('ERROR','SALESPD MAIL NOT SEND'.$mail_contents[1].'- mail Error - '.$mail->ErrorInfo);
if($try == 4)
{
goto stopSendAttempt;
}
$try++;
log_message('ERROR','SALESPD MAIL attempt'.$try.' '.$mail_contents[1].'- mail Error - '.$mail->ErrorInfo);
goto sendMailAgain;
} else {
//$logger->info("Mailer Send:" ,array('mail_ID' => $lender_email,'Status' => 'SEND'));
//echo 'DONE';
//echo 'send';
$mail_send_status = 'Sent';
log_message('ERROR','SALESPD MAIL SEND'.$mail_contents[1]);
}
stopSendAttempt:
//update mail sent status to sales pd master
SELF::updateSalesPDmailStatus($CI,$salespd_id,$mail_send_status);
}
}
@ -621,6 +638,15 @@ class PDALERTS
$subject = 'PD '.$dynamic .' For Application ID -'.$core_details[0]['lender_applicant_id'];
return ENVIRONMENT == 'testing' || ENVIRONMENT == 'development' ? $subject .= ' ( TEST ENV ) ' : $subject;
}
public static function updateSalesPDmailStatus($CI,$salespd_id,$mail_send_status)
{
//echo 'UPDAT called';
$d = $CI->Sales_PD_Model->updateRecords(array('mail_status' => $mail_send_status),SALES_PD_DATA,array('sales_pd_id' => $salespd_id) );
//print_r($CI->db->last_query);
//echo $d;
}
}