Answers.Body: <p>We've done just this using CiviRules and CiviReport, though the solution does still send emails if the smart group is empty.</p>
  
  <p>I've outlined the steps here: <a href="https://civicrm.stackexchange.com/a/4873/105">https://civicrm.stackexchange.com/a/4873/105</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-12T05:12:32.300Z
Answers.Text: Right, that's the very sticking point I'm trying to avoid -- should send no email if the smart group it's empty. Except for that point, CiviReport's own email feature would do fine for my use case.
Answers.UserDisplayName: TwoMice
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-12T04:59:41.793Z
Answers.LastActivityDate: 2017-01-12T04:59:41.793Z
Answers.LastEditDate: 2017-04-13T12:53:13.017Z
Answers.UserDisplayName: Allen Hutchison
Answers.Body: <p>Have you tried using CiviCRM Rules integration? Not sure if it would work in the context of a scheduled job, but it can send emails.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-12T03:40:23.463Z
Answers.LastActivityDate: 2017-01-12T03:40:23.463Z
Answers.UserDisplayName: Coleman
Body: <p><strong>The problem:</strong></p>
  
  <p>I'm trying to monitor daily for contacts meeting certain criteria, and would thus like to have a way to receive a scheduled email if a smart group contains contacts.</p>
  
  <p><strong>Possible solution: Using CiviReport?</strong></p>
  
  <p>CiviReport supports scheduled delivery of reports, configurable under a report's "Email Delivery" tab.</p>
  
  <p>Is there a way to avoid sending the report if it contains no rows?</p>
  
  <p>Alternately, I could do something in cron with <code>drush sql-query</code> or some such, but ideally I'd like to do this within CiviCRM.</p>
  
  <p><strong>Other options:</strong></p>
  
  <p>Are there other to achieve this goal within CiviCRM that would not require custom code?</p>
  
Tags: <civireport><scheduled-job>
Title: Send alert if smart group contains any contacts
ThreadText: # Send alert if smart group contains any contacts
  
  (Asked by: username_0 on 2017-01-12)
  
  **The problem:**
  
  I'm trying to monitor daily for contacts meeting certain criteria, and would thus like to have a way to receive a scheduled email if a smart group contains contacts.
  
  **Possible solution: Using CiviReport?**
  
  CiviReport supports scheduled delivery of reports, configurable under a report's "Email Delivery" tab.
  
  Is there a way to avoid sending the report if it contains no rows?
  
  Alternately, I could do something in cron with `drush sql-query` or some such, but ideally I'd like to do this within CiviCRM.
  
  **Other options:**
  
  Are there other to achieve this goal within CiviCRM that would not require custom code?
  
  **Tags:** civireport, scheduled-job
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2017-01-12. Score: 1
  
  We've done just this using CiviRules and CiviReport, though the solution does still send emails if the smart group is empty.
  
  I've outlined the steps here: <https://civicrm.stackexchange.com/a/4873/105>
  
  > **Comments:**
  > **username_0**: Right, that's the very sticking point I'm trying to avoid -- should send no email if the smart group it's empty. Except for that point, CiviReport's own email feature would do fine for my use case.  
  
  ---
  
  ### Answer by username_2 on 2017-01-12. Score: 0
  
  Have you tried using CiviCRM Rules integration? Not sure if it would work in the context of a scheduled job, but it can send emails.
  
  
  ---
  
  