Hi All,
I have a requirement to send a mail to admin about something based on a table value,for which I wrote a code in php file and placed this in one of the template,please check sample code
$this->EE->load->library('email');
$this->EE->email->initialize(array(
'mailtype' => 'html',
'validate' => TRUE,
));When I run the template (http://example.com/sendmail) in a browser everything works ok,but when I added this template in the cron job list I am getting an error from my host that its unable to find the file or directory,please check
/bin/sh: <a href="http://example.com/sendmail">http://example.com/sendmail</a>: No such file or directory
Then I tried creating a folder at my root and placed that php code in a file,now when I checked that file in the browser,I am getting an error like
Fatal error: Using $this when not in object context in /home/s23betawbr/public_html/site/cron/communication/sendmails.php on line 32I think I am not able to use $this->EE in a php file,can anyone please help me out how about how to use EE super object outside templates like in any php file.
OR how to add the cron job when the code is in a template
Thanks in advance
Cheers!!