1

In our development environment I redirect mails following some specific rules. I am quite sure that I achieved that in the past with hook__civicrm_alterMailParams where I changed the $params['toEmail'] to whatever email suited. Additionally I changed $params['text']to have some info about the original email address.

Now this logic starts to fail after upgrading from CiviCRM 5.50.0 to 5.50.2 (when you send a mail to an individual contact from the contact view page). The reason is that $params['toEmail] has now the value NULL instead of a string with the email address. For sending mass mailings this logic still works - for every single email the hook is called with an $params array with 'toEmail' set.

The release notes from 5.50.1 and 5.50.2 did not show any code changes that seem to be related to that. How can I find someone to check that? It seems to be a main issue to me when changes like that are made in core without any information.

1 Answer 1

1

The hook_civicrm_alterMailParams(&$params, $context) hook is called twice

  1. $context == 'messageTemplate' -> When building the message, at this moment the toEmail is not set
  2. $context == 'singleEmail' -> called when email is build and about to send.

HTH

Pradeep

1
  • 1
    Thank you so much... I simply forgot about that and made a change in my own code that did not respect that fact. Sorry for the noise! Commented Jun 22, 2022 at 13:59

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.