Welcome Guest, Not a member yet? Register   Sign In
What to use to send an email atomatically at certain time of day
#5

OK I have been trying to dabble for a while now and I am at the stage that if I run it myself it works fine and does what I want it, if I try to cron job it, it errors as it doesn't have all the information.

PHP Code:
public function index(){
 
           
            $this
->load->dbutil();

 
           $backup $this->dbutil->backup(); 

 
           $this->load->helper('file');
 
           $subject 'backup-'.date("d-m-Y").' from Site Name';
 
           $file_name 'backup-'.date("d-m-Y").'.gz';
 
           write_file($file_name$backup); 
 
           $this->email->from('[email protected]''Backup System');
 
           $this->email->to('[email protected]');
 
           $this->email->subject($subject);
 
           $all 'Filename: '.$file_name."<br>";
 
           $this->email->message($all);
 
           $this->email->attach($file_name);
 
           $this->email->send(); 
 
           delete_files('backup/');


 
       

I have removed the emails from this code.  When I get cron to run it, I get an error right at the start with the CI_controller as I know that it doesn't know what it is as its not ran everything else in the browser first.  All this is doing is grabbing the database and packing it into a file, sending it to an email address and then deleting the file in the folder (not that bothered about the deleting part atm).  Would I have to look into my own CI_controller, if so any tips on what I should be trying to make in there?
Reply


Messages In This Thread
RE: What to use to send an email atomatically at certain time of day - by doomie22 - 04-27-2016, 04:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB