hi I am new to Expression engine I am getting total channel entries using EE Tag :-

{exp:stats channel="products" site="default_site"}{total_entries}{/exp:stats}

Now I want a email report that gives me total no of channel entries on daily basis I can use cron job but i want to know how to do this procedure.

1 Answer 1


First, make a hidden template, probably in template group called cron. For safety, you'll need to have some .htaccess rules that prevents anyone but your server from being able to reach this template. Then, in that template, turn on PHP. Here's an example to help (assuming a channel ID of 1):


// get number of products
$num_of_products = ee()->db->select()
                           ->where("channel_id", "1")

// use the email class to send this information out
$email_msg = "Hello, we have {$num_of_products} today.";
$notify_address = "[email protected]";


ee()->email->wordwrap = true;
ee()->email->mailtype = "text";
ee()->email->from("[email protected]");
ee()->email->subject("Daily update");
// optional
// ee()->email->message(entities_to_ascii($email_msg));


Then, using cron and curl, set a cron job to curl that address once a day. Remember to set .htaccess to deny access to that template file from any requester except self ( Now you can use addons like PostMaster to make this whole process much easier, but you have to purchase them. I'm giving you a raw but free answer.

  • I have postmaster addon please tell me how to do this job with that and i want to send only daily channel entries not total.
    – Abhay
    Oct 22, 2015 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.