35.9 SEND Function Signature 2
This function returns a mail ID after adding the mail to the mail queue of APEX. The mail ID can be used in a call to add_attachment to add attachments to an existing mail.
                  
The mail is based on an email template where the placeholder values specified as JSON string are substituted.
Syntax
FUNCTION SEND (
    p_template_static_id    IN VARCHAR2,
    p_placeholders          IN CLOB,
    p_to                    IN VARCHAR2,
    p_cc                    IN VARCHAR2 DEFAULT NULL,
    p_bcc                   IN VARCHAR2 DEFAULT NULL,
    p_from                  IN VARCHAR2 DEFAULT NULL,
    p_replyto               IN VARCHAR2 DEFAULT NULL,
    p_application_id        IN NUMBER   DEFAULT apex_application.g_flow_id,
    p_language_override     IN VARCHAR2 DEFAULT NULL );
    RETURN NUMBER;
Parameters
Table 35-6 SEND Function Parameters
| Parameter | Description | 
|---|---|
| p_template_static_id | Static identifier string, used to identify the shared component email template. | 
| p_placeholders | JSON string representing the placeholder names along with the values, to be substituted. | 
| p_to | Valid email address to which the email is sent (required). For multiple email addresses, use a comma-separated list. | 
| p_cc | Valid email addresses to which the email is copied. For multiple email addresses, use a comma-separated list. | 
| p_bcc | Valid email addresses to which the email is blind copied. For multiple email addresses, use a comma-separated list. | 
| p_from | Email address from which the email is sent (required). This email address must be a valid address. Otherwise, the message is not sent. | 
| p_replyto | Address of the Reply-To mail header. You can use this parameter as follows: 
 | 
| p_application_id | Application ID where the email template is defined. Defaults to the current application (if called from within an application). | 
| 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. | 
Note:
When calling the SEND function from outside the context of an APEX application (such as from a Database Scheduler job), you must specify the p_application_id parameter.
                     
Examples
DECLARE
    l_mail_id number;
BEGIN
    l_mail_id := apex_mail.send (
        p_template_static_id => 'ORDER',
        p_placeholders       => '{ "ORDER_NUMBER": 5321, "ORDER_DATE": "01-Feb-2018", "ORDER_TOTAL": "$12,000" }',
        p_to                 => 'some_user@example.com' );
    apex_mail.add_attachment (
        p_mail_id    => l_mail_id,
        p_attachment => ... );
END;Parent topic: APEX_MAIL