Answers.Body: <p>Solution: replace current lines in Utils/Mail.php where no check for null CC, BCC is made, with the following (line 194 +) from older version of Mail.php:</p>
  
  <pre><code>if (CRM_Utils_Array::value('cc', $params) != NULL){
    $headers['Cc'] = CRM_Utils_Array::value('cc', $params);
  }
  if (CRM_Utils_Array::value('bcc', $params) != NULL){
    $headers['Bcc'] = CRM_Utils_Array::value('bcc', $params);
  }
  </code></pre>
  
  <p>I don't know why the code was changed to not check for null. It seems it doesn't hurt to check, and if null CC/BCC are put into headers, mail() fails.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-18T20:30:53.657Z
Answers.Text: Which "older" version of `Utils/Mail.php` were you looking at? It [doesn't look like those lines changed recently to me](https://github.com/civicrm/civicrm-core/blame/master/CRM/Utils/Mail.php), assuming we're talking about the same - `CRM/Utils/Mail.php` in civicrm-core.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-18T20:32:40.847Z
Answers.Text: I'd be asking: Why is this specific server / site putting `null` into those values? And, do other sites *not* do that? It would be worth reporting this issue over on JIRA (https://issues.civicrm.org) if you can reproduce it, that way you can get a fix upstream (and avoid future patching), or identify the underlying issue specific to this site (and address a cause which only affects this instance).
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-16T15:31:50.377Z
Answers.LastActivityDate: 2017-06-18T20:23:50.273Z
Answers.LastEditDate: 2017-06-18T20:23:50.273Z
Answers.UserDisplayName: Lesley Evensen
Body: <p>Acc'ding to Civi documentation, PEAR packages needed by Civi are included w/the install, so the mailer functionality is determined by Civi.
  I am running Civi for WP v 4.7.20 with PHP 5.6.16 and Apache 2.4
  System mail setting is mail() - the mail 'test' works because only 'from','to','subject' and 'message' are set.  But system mail (e.g. registration mail or ad hoc mail sent to event participant) fails.</p>
  
Tags: <email>
Title: 4.7 Utils/Mail.php doesn't check if CC/BCC are null but should
ThreadText: # 4.7 Utils/Mail.php doesn't check if CC/BCC are null but should
  
  (Asked by: username_0 on 2017-06-16)
  
  Acc'ding to Civi documentation, PEAR packages needed by Civi are included w/the install, so the mailer functionality is determined by Civi.
  I am running Civi for WP v 4.7.20 with PHP 5.6.16 and Apache 2.4
  System mail setting is mail() - the mail 'test' works because only 'from','to','subject' and 'message' are set. But system mail (e.g. registration mail or ad hoc mail sent to event participant) fails.
  
  **Tags:** email
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-06-16. Score: 1
  
  Solution: replace current lines in Utils/Mail.php where no check for null CC, BCC is made, with the following (line 194 +) from older version of Mail.php:
  
  ```
  if (CRM_Utils_Array::value('cc', $params) != NULL){
    $headers['Cc'] = CRM_Utils_Array::value('cc', $params);
  }
  if (CRM_Utils_Array::value('bcc', $params) != NULL){
    $headers['Bcc'] = CRM_Utils_Array::value('bcc', $params);
  }
  
  ```
  
  I don't know why the code was changed to not check for null. It seems it doesn't hurt to check, and if null CC/BCC are put into headers, mail() fails.
  
  > **Comments:**
  > **username_1**: Which "older" version of `Utils/Mail.php` were you looking at? It [doesn't look like those lines changed recently to me](https://github.com/civicrm/civicrm-core/blame/master/CRM/Utils/Mail.php), assuming we're talking about the same - `CRM/Utils/Mail.php` in civicrm-core.  
  > **username_1**: I'd be asking: Why is this specific server / site putting `null` into those values? And, do other sites *not* do that? It would be worth reporting this issue over on JIRA (https://issues.civicrm.org) if you can reproduce it, that way you can get a fix upstream (and avoid future patching), or identify the underlying issue specific to this site (and address a cause which only affects this instance).  
  
  ---
  
  