Hi @colorinside
I hope you’re well today!
You can use one of the following filters:
1. forminator_custom_form_mail_admin_headers
to directly modify e-mail headers (e.g. set/modify From header)
2. forminator_custom_form_mail_admin_cc_addresses
to set CC address(es)
3. forminator_custom_form_mail_admin_bcc_addresses
to set BCC address(es)
All those filters are defined in the /forminator/library/modules/custom-forms/front/front-mail.php file so you can take a look there to see how they are used there.
If you have any additional/follow-up questions, let us know.
Kind regards,
Adam
Hello Adam,
thank you for your quick reply.
I need to update the default recipient I’ve set via Forminator Admin, the hooks you reported are for other headers.
Basically: the message must be sent to a specific user, selected with a complex query that cannot be done with routing.
Why the /forminator_form_get_admin_email_recipients hook is not working?
Thank you very much!
Hi @colorinside
We would need to check your code but I did the following:
add_filter('forminator_form_get_admin_email_recipients', function ($email, $notification, $data, $module, $entry) {
$email[0] = 'new@email.com';
error_log('forminator_form_get_admin_email_recipients');
error_log(print_r($email, true));
return $email;
}, 10, 5);
It logged in the debug.log + received the email in the new destination rather than the one defined in the interface.
https://monosnap.com/file/6qpGOliSshFOS9vsDSJ52HEE1bjZOB
Best Regards
Patrick Freitas
Hi Patrick,
thank you very much for you support. The issue was related to another function hooked to forminator_custom_form_mail_admin_message that did not properly return $message.
Now everything is working fine, you can considered this topic as “solved”.
Thank you!
-
This reply was modified 1 year, 9 months ago by
colorinside.