We've set up a Apex REST endpoint to send emails on behalf of an external system.
Data to fill the templates will be sent in the JSON payload to the REST endpoint.
We're finding that the data is going to be diverse and changing and like to simply pass the data from the JSON payload into the email template without storing it on an object first.
I see that we can set a WhatId
and a TargetObjectId
when using the Messaging.SingleEmailMessage
object, but it doesn't seem to support ephemeral fields.
Is it possible to send a templated email in Apex without storing the data first?