Intercept outbound email

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2023 03:24 AM - edited 03-27-2023 07:56 AM
Hi,
I have a little bit of an unusual use case I am working on, the requirement is for certain notifications to be sent via a third party REST API which will then use the HTML it is provided to send the email to the end users. (The third party provides advanced tracking and analytics)
The notifications are existing ones that contain complex notification email scripts and the users that maintain them are familiar with editing the HTML in the notifications form so I would rather not change this.
This leaves me needing to intercept the email between the HTML being rendered and the email being sent by SN. Currently I am considering a business rule on the sys_email table to set the state to ignored or processed so it is not sent by SN and then trigger the third party API.
I would welcome suggestions from others on this scenario and how they might approach it bearing in mind the need for users to be able to maintain the notifications in the notification form.
Thanks in advance for any suggestions,
Richard
** EDIT **
I implemented the business rule and it worked perfectly, I set the state to 'ignored', type to 'send-ignored' and mailbox to skipped. Had to implement additional logic to make the images inline using <img src='data:image/jpg;base64,' but everything worked well. Hope this is useful to someone in the future...