41.6 PREPARE_TEMPLATE Procedure
Procedure to return a formatted mail based on an e-mail template where the placeholders specified as JSON string are substituted.
Syntax
APEX_MAIL.PREPARE_TEMPLATE (
    p_static_id         IN  VARCHAR2,
    p_placeholders      IN  CLOB,
    p_application_id    IN  NUMBER   DEFAULT apex_application.g_flow_id, 
    p_subject           OUT VARCHAR2,
    p_html              OUT CLOB,
    p_text              OUT CLOB,
    p_language_override IN  VARCHAR2 DEFAULT NULL );Parameters
| Parameters | Description | 
|---|---|
| p_static_id | The identifier which was specified when the template was created in the Oracle APEX Builder. | 
| p_placeholders | A JSON formatted string containing name/value pairs specifying values for the placeholders to be replaced in the email template. | 
| p_application_id | Application ID where the email template is defined. Defaults to the current application (if called from within an application). | 
| p_subject | The subject line generated from the template, after any placeholders and substitutions have been made. | 
| p_html | The HTML code for the email, after placeholders have been replaced. | 
| p_text | The plain text of the email, with substitutions made. | 
| p_language_override | Language of a translated template to use. Use a language code like "en", "fr" or "de-at" here. An application translation for this language must exist, otherwise the argument is ignored. | 
Example
declare
  l_subject varchar2( 4000 );
  l_html    clob;
  l_text    clob;
begin
  apex_mail.prepare_template (
  p_static_id    => 'ORDER',
  p_placeholders => '{ "ORDER_NUMBER": 5321, "ORDER_DATE": "01-Feb-2018", "ORDER_TOTAL": "$12,000" }',
  p_subject      => l_subject,
  p_html         => l_html,
  p_text         => l_text );
end;Parent topic: APEX_MAIL