I want to create a module which alters the recipients of all outgoing emails so that in dev environment email are only sent to developers or testers and not to real users. So the recipients should be altered before sending the email in defined circumstances.
I tried hook_civicrm_alterMailingRecipients()
but this hooks gets called when I create a mailing and add recipients to the corresponding field. This is not what I need - I don't want to alter the recipients on creation of a mass/bulk mailing.
Is there any way to alter recipients for all outgoing email (indiviual emails, mailings, system mails - if there are any) in any way? In Drupal we have hook_mail_alter()
which allows to alter just everything in an email and which I used for this functionality already.