1

I am getting the above error message when trying to send a quick email to less then 50 contacts via extended search. I setup the outgoing email as SMTP + sender address and was able to send a test email. I didn't configure any crons yet because I thought that was only required for CiviMail but maybe I'm wrong. Any help appreciated...

Stacktrace top:

[error] Mailing error: #0 /opt/drupal/vendor/pear/pear-core-minimal/src/PEAR.php(945): CRM_Core_Error::exceptionHandler(Object(PEAR_Error))
#1 /opt/drupal/vendor/pear/pear-core-minimal/src/PEAR.php(577): PEAR_Error->__construct('Expected a stri...', NULL, 16, Array, NULL)
#2 /opt/drupal/vendor/pear/pear-core-minimal/src/PEAR.php(236): PEAR::_raiseError(NULL, 'Expected a stri...')
#3 /opt/drupal/vendor/pear/net_smtp/Net/SMTP.php(1220): PEAR::__callStatic('raiseError', Array)
#4 /opt/drupal/vendor/pear/mail/Mail/smtp.php(391): Net_SMTP->data(NULL, 'MIME-Version: 1...')
#5 /opt/drupal/vendor/pear/mail/Mail/smtp.php(319): Mail_smtp->send_or_fail(Array, Array, NULL)
#6 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Utils/Mail/FilteredPearMailer.php(77): Mail_smtp->send(Array, Array, NULL)
#7 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Utils/Mail.php(208): CRM_Utils_Mail_FilteredPearMailer->send(Array, Array, NULL)
#8 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Contact/Form/Task/EmailTrait.php(934): CRM_Utils_Mail::send(Array)
#9 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Contact/Form/Task/EmailTrait.php(797): CRM_Contact_Form_Task_Email->sendMessage('"CiviCRM" <vern...', '5', 'Test', '', '', 'jan.ciriack@pos...', 539, Array, '', '')
#10 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Contact/Form/Task/EmailTrait.php(388): CRM_Contact_Form_Task_Email->sendEmail('', '', '"CiviCRM" <vern...', Array, '', '', '', NULL, NULL)
#11 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Contact/Form/Task/EmailTrait.php(336): CRM_Contact_Form_Task_Email->submit(Array)
#12 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Core/Form.php(646): CRM_Contact_Form_Task_Email->postProcess()
#13 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Upload.php(153): CRM_Core_Form->mainProcess()
#14 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Upload.php(120): CRM_Core_QuickForm_Action_Upload->realPerform(Object(CRM_Contact_Form_Task_Email), 'upload')
#15 /opt/drupal/vendor/civicrm/civicrm-packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Upload->perform(Object(CRM_Contact_Form_Task_Email), 'upload')
#16 /opt/drupal/vendor/civicrm/civicrm-packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Task_Email), 'upload')
#17 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle('upload')
#18 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(325): CRM_Core_Controller->run(Array, Array)
#19 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem(Array)
#20 /opt/drupal/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke(Array)
#21 /opt/drupal/web/modules/contrib/civicrm/src/Civicrm.php(88): CRM_Core_Invoke::invoke(Array)
#22 /opt/drupal/web/modules/contrib/civicrm/src/Controller/CivicrmController.php(83): Drupal\civicrm\Civicrm->invoke(Array)
#23 [internal function]: Drupal\civicrm\Controller\CivicrmController->main(Array, '')
6
  • Quick email doesn't need cron. Are there error messages in the log file?
    – Aidan
    Commented May 1 at 8:18
  • There is only this one liner in the log. Looks like the send call throws an exception: github.com/civicrm/civicrm-core/blob/…
    – Jan
    Commented May 1 at 10:40
  • You can try adding $e->getTraceAsString() to that line, so that it also logs the stack trace.
    – Demerit
    Commented May 6 at 23:42
  • I have added the stacktrace above. It doesn't tell me a lot though.
    – Jan
    Commented May 10 at 22:54
  • It tells us that $message is the problem var (3 lines up), so then my next step would be to debug what is $message and what is $params['html'], and if it's not obvious from that, then what happens inside self::setEmailHeaders().
    – Demerit
    Commented May 11 at 0:30

1 Answer 1

1

I've put up a PR at https://github.com/civicrm/civicrm-core/pull/30172. It worked for me. Can you confirm it also fixes it for you?

Just on line 208 of CRM/Utils/Mail.php, change

$result = $mailer->send($to, $headers, $message);

to

$result = $mailer->send($to, $headers, $message ?? '');

1
  • Yes, it's fixed. I wouldn't do the null check inside the send call though, probably inside setEmailHeaders.
    – Jan
    Commented May 14 at 21:35

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.