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.


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.

  • Which "older" version of Utils/Mail.php were you looking at? It doesn't look like those lines changed recently to me, assuming we're talking about the same - CRM/Utils/Mail.php in civicrm-core. Jun 18 '17 at 20:30
  • 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 (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). Jun 18 '17 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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