Answers.Body: <p>This turned out to be something adding a blank line in the cron output (see comments above). Since it's not clear what is adding it or how to track it down, a workaround is to adjust the cron command slightly:</p>
  
  <p><code>your-cron-command | grep "."</code></p>
  
  <p>which will remove all blank lines from the output, so if the output is just a newline then after the grep the output will be completely empty and not send an email as normal. In some hosting control panels you might need to backslash the pipe character, or create a wrapper script and have cron call that script.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-11T17:14:57.500Z
Answers.LastActivityDate: 2019-07-11T17:14:57.500Z
Answers.UserDisplayName: Demerit
Body: <p>Since I upgraded to Civi 5.11 (from 4.7) I am seeing empty emails from the cron daemon every time it runs the scheduled jobs. Previously I have only had emails when there has been some issue with the cron or what looks like an error from one of the scheduled jobs. The scheduled jobs look to all be fine in the log.</p>
  
  <p>The problem is that it would hide any genuine error messages as I'm not going to go through all these emails.</p>
  
  <p>Running on Wordpress 5.1.1 hosted on Siteground.</p>
  
  <p>Update: I still want to resolve this. Part of the problem is I don't know where the messages with some content are coming from - they are all</p>
  
  <p>"/usr/sbin/sendmail: unexpected response 501 to RCPT TO command"</p>
  
  <p>I don't know exactly what they mean, but they did relate to a genuine problem with delivering mail. So I'd like to keep them. But they are few and far between and I haven't seen one for ages (maybe because there haven't been any bulk mailings). If I divert stdout to /dev/null will I lose the good as well as the bad. Not sure how to test it.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-08T23:18:19.373Z
Comments.Text: Update: I still want to resolve this. Part of the problem is I don't know where the messages with some content are coming from - they are all
  
  "/usr/sbin/sendmail: unexpected response 501 to RCPT TO command"
  
  I don't know exactly what they mean, but they did relate to a genuine problem with delivering mail. So I'd like to keep them. But they are few and far between and I haven't seen one for ages (maybe because there haven't been any bulk mailings). If I divert stdout to /dev/null will I lose the good as well as the bad. Not sure how to test it.
Comments.UserDisplayName: Mick Kahn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-09T00:04:08.027Z
Comments.Text: The 501's are probably emails in civi that are badly formatted, e.g. "jsmith@example.com / mbrown@example.com". For the original problem where you started receiving blank emails with every cron run it suggests something in civi or an extension is outputting some whitespace. If you run cron manually and redirect to a file and then examine the contents with a binary editor, or even just pipe it through `od` then you can confirm if that's what's happening, e.g. `your-cron-command | od -c`. It might be something like an extra blank line was added in your wp-config file or civicrm.settings.php.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-10T20:25:50.703Z
Comments.Text: Demerit - thanks - pointing me in the right direction. Running manually has shown that cron is producing a newline character (x0A) and presumably it wasn't before. Can't see that the config files will do this but will look at them. But I think my work round will just be to append all the cron output to a file and look at that once a week to see if there are any real errors.
Comments.UserDisplayName: Mick Kahn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-10T20:28:08.313Z
Comments.Text: Demerit - I think the sendmail errors are probably for a separate question, but they aren't badly formed addresses. I can't see any pattern yet in what could cause them and (fortunately) I haven't seen any for a while.
Comments.UserDisplayName: Mick Kahn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-10T22:25:12.837Z
Comments.Text: If you can't find where the newline is coming from, then one possibility is alter your cron command slightly: `your-cron-command | grep "."`, which will remove all blank lines from the output, so if the output is just a newline then after it will be completely empty and not send an email as normal. In some hosting control panels you might need to backslash the pipe character, or create a wrapper script and have cron call that script.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-11T17:06:39.683Z
Comments.Text: Demerit - thanks - that's a very acceptable work around, better than mine and saves having to work out why this changed. If you put it as an answer I will accept it.
Comments.UserDisplayName: Mick Kahn
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-07-11T17:15:34.433Z
Comments.Text: Great, added! ..
Comments.UserDisplayName: Demerit
Tags: <wordpress><cron><siteground>
Title: blank emails from cron after upgrade Wordpress
ThreadText: # blank emails from cron after upgrade Wordpress
  
  (Asked by: username_0 on 2019-04-06)
  
  Since I upgraded to Civi 5.11 (from 4.7) I am seeing empty emails from the cron daemon every time it runs the scheduled jobs. Previously I have only had emails when there has been some issue with the cron or what looks like an error from one of the scheduled jobs. The scheduled jobs look to all be fine in the log.
  
  The problem is that it would hide any genuine error messages as I'm not going to go through all these emails.
  
  Running on Wordpress 5.1.1 hosted on Siteground.
  
  Update: I still want to resolve this. Part of the problem is I don't know where the messages with some content are coming from - they are all
  
  "/usr/sbin/sendmail: unexpected response 501 to RCPT TO command"
  
  I don't know exactly what they mean, but they did relate to a genuine problem with delivering mail. So I'd like to keep them. But they are few and far between and I haven't seen one for ages (maybe because there haven't been any bulk mailings). If I divert stdout to /dev/null will I lose the good as well as the bad. Not sure how to test it.
  
  **Tags:** wordpress, cron, siteground
  
  > **Comments:**
  > **username_0**: Update: I still want to resolve this. Part of the problem is I don't know where the messages with some content are coming from - they are all  "/usr/sbin/sendmail: unexpected response 501 to RCPT TO command"  I don't know exactly what they mean, but they did relate to a genuine problem with delivering mail. So I'd like to keep them. But they are few and far between and I haven't seen one for ages (maybe because there haven't been any bulk mailings). If I divert stdout to /dev/null will I lose the good as well as the bad. Not sure how to test it.  
  > **username_1**: The 501's are probably emails in civi that are badly formatted, e.g. "jsmith@example.com / mbrown@example.com". For the original problem where you started receiving blank emails with every cron run it suggests something in civi or an extension is outputting some whitespace. If you run cron manually and redirect to a file and then examine the contents with a binary editor, or even just pipe it through `od` then you can confirm if that's what's happening, e.g. `your-cron-command | od -c`. It might be something like an extra blank line was added in your wp-config file or civicrm.settings.php.  
  > **username_0**: username_1 - thanks - pointing me in the right direction. Running manually has shown that cron is producing a newline character (x0A) and presumably it wasn't before. Can't see that the config files will do this but will look at them. But I think my work round will just be to append all the cron output to a file and look at that once a week to see if there are any real errors.  
  > **username_0**: username_1 - I think the sendmail errors are probably for a separate question, but they aren't badly formed addresses. I can't see any pattern yet in what could cause them and (fortunately) I haven't seen any for a while.  
  > **username_1**: If you can't find where the newline is coming from, then one possibility is alter your cron command slightly: `your-cron-command | grep "."`, which will remove all blank lines from the output, so if the output is just a newline then after it will be completely empty and not send an email as normal. In some hosting control panels you might need to backslash the pipe character, or create a wrapper script and have cron call that script.  
  > **username_0**: username_1 - thanks - that's a very acceptable work around, better than mine and saves having to work out why this changed. If you put it as an answer I will accept it.  
  > **username_1**: Great, added! ..  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-07-11. Score: 1 | Accepted answer
  
  This turned out to be something adding a blank line in the cron output (see comments above). Since it's not clear what is adding it or how to track it down, a workaround is to adjust the cron command slightly:
  
  `your-cron-command | grep "."`
  
  which will remove all blank lines from the output, so if the output is just a newline then after the grep the output will be completely empty and not send an email as normal. In some hosting control panels you might need to backslash the pipe character, or create a wrapper script and have cron call that script.
  
  
  ---
  
  