Idea Summary
An enhancement for in APEX that could be useful is the implementation of a Pre Hook Function for Apex_MAIL, the built-in email service in APEX.
The Pre Hook Function would allow developers/instance admin to execute custom code before sending an email through Apex_MAIL or other emails . This would be useful in scenarios where certain email content or recipients need to be modified or validated before sending.
To implement this enhancement, APEX would need to add a new API to register a Pre Hook Function at instance , workspace or application level. The function would receive the email content and recipients as input parameters, allowing the developer to modify them as needed.
For example, a Pre Hook Function could be used to check if a recipient is a valid email address, or to add dynamic content to the email body based on user input. This would provide greater flexibility and customization options for developers using Apex_MAIL in their applications.
Also It would be nice to have post hook function
Use Case
What are the use cases in which this idea useful?
- Add header in in Non Production environments ("This mail is from Test System")
- Filter out mail non trusted domain , Eg Inside oracle the mail should be send out to only @oracle.com com
- Limit mails send to users, for example if we copy the application from production to non production , only subscribed users on that users should receive the mai
- Scan email
Preferred Solution (Optional)