I have followed https://bigprof.com/appgini/help/advanc ... ch-actions
Code: Select all
function applicants_and_tenants_batch_actions(&$args){
return array(
array(
'title' => 'Send Rent Reminders',
'function' => 'send_rent_reminder',
'icon' => 'calendar'
)
);
}
Code: Select all
function send_rent_reminder(table_name, ids){
// ******** Send email if checkbox is checked *********
$recipient = $data['emailto'];
$CC = "";
$sendemail=sqlValue("SELECT first_name, last_name, late_rent_reminder_date, emailto, balance FROM `applicants_and_tenants` JOIN `residence_and_rental_history` ON `applicants_and_tenants`.`id` = `residence_and_rental_history`.`tenant` WHERE `applicants_and_tenants`.`id`='{$data['selectedID']}'");
if($sendemail!=0){
$resetMail=@mail(
// To
$recipient,
// Subject
"Rent Reminder Date",
// Content
"Just add whatever content and fields you want to the email.\n" .
"Account No.: {$data['contract']}\n" .
"Name: {$data['name']}\n" .
"Our Job No.: {$data['id']}\n" .
"Current Job Status: {$data['status']}\n",
// From
"From: [email protected]"
);
// then update the send email checkbox back to default of 0
if(resetMail){
sql("update jobs set emailadvice=0 where ourref='{$data['selectedID']}'", $abc);
}
}
// ******** End send email if checkbox is checked *******
}