Sending an Email Notification from a batch_action
Posted: 2016-07-06 12:30
I want to send a rent reminder email to tenants. I hava a batch action as below
I have followed https://bigprof.com/appgini/help/advanc ... ch-actions
Then i have a file called applicants_and_tenants-tv.js with the following code.
But the Batch action is not responding even if i try to do a var_dump to test my sql query. How can i go about this? Thank you.
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 *******
}