Create a new hook for EmailPreProcess
Due to some emails being considered spam (containing invalid or not secure domain names, that are being notified), we need to implement a filter to rename domain.com to domain(dot)com.
As this option is not available we would do this via a hook. Other processings could also be implemented before an email is sent.
the current hooks do not work:EmailPreLog - this hook contains the message body, however even if we modify the message body, it only modifies what is logged and not what is sent. This hook has no option to prevent sending to implement manual sending.
EmailPreSend - this hook would be ideal, but contrart to it's name it is not used to preprocess a message, it only contains merge fields. This hook does not receive the email subject or message so we cannot process the message via this hook
I propose creating a new hook:
EmailPreProcess - this should get the email data, same as EmailPreLog, do it's processing on the content, then return the modified content if needed, prevent sending or send with modified content.