Jump to content

Sending php cron script results/output to an e-mail


Recommended Posts

I am running a cron job every night (importing products from feed) and I would like to get the results to my e-mail after the script ends. Can you help me to implement this?


I have cron.php in which is this:



<?php

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/importfast.php');

$importFast = new ImportFast();
$importFast->cron();

?>

Can this be done? Maybee to this file or to /importfast.php? And how to make it?


Thank you very much for help,


Daniel


Link to comment
Share on other sites

Yes it can be done. You must figure out how to retrieve the info that has to be sent to you with an email and set it up.

if we assume that you alter the cron function a bit in order to return the data inserted your code should be changed to something like

<?php

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/importfast.php');

$importFast = new ImportFast();
$data = $importFast->cron();
mail("[email protected]","My subject",$data);

?>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...