I want to create a php script that will be connected to a cron task and this script will send an email to me if something is found in database.
I was thinking of creating the php file in the root directory of my cs cart installation with something like this in it:
<?php use Tygh\Mailer;get_something_from_database;
if(something==true)
{
Mailer::sendMail(array(
‘to’ => ‘test@example.com’,
‘from’ => ‘company_users_department’,
‘reply_to’ => $un[‘shop_user_id’],
‘data’ => array(
‘user_data’ => $user_data,
‘product_name’ => $un[‘name’],
‘syntheseis’ => $product_code,
),
‘tpl’ => ‘profiles/disabled_product.tpl’,
‘company_id’ => $shop_data[‘full_description’]
), ‘A’, Registry::get(‘settings.Appearance.backend_default_language’));
}
?>
But when I tried to run this script from the browser, like: "http://localhost/cs/name_of_php.php
I get 2 basic errors.
First that it cannot connect to Database, and second, that it cannot find the Tygh\Mailer
Any ideas how to create my script?