Home > APEX_MAIL > ADD_ATTACHMENT Proce...
Previous |
Next |
This procedure sends an outbound email message from an application as an attachment. To add multiple attachments to a single email, APEX_MAIL.ADD_ATTACHMENT
can be called repeatedly for a single email message.
Syntax
APEX_MAIL.ADD_ATTACHMENT( p_mail_id IN NUMBER, p_attachment IN BLOB, p_filename IN VARCHAR2, p_mime_type IN VARCHAR2);
Parameters
Table: ADD_ATTACHMENT Parameters describes the parameters available in the ADD_ATTACHMENT
procedure.
ADD_ATTACHMENT Parameters
Parameter | Description |
---|---|
|
The numeric ID associated with the email. This is the numeric identifier returned from the call to |
|
A |
|
The filename associated with the email attachment. |
|
A valid MIME type (or Internet media type) to associate with the email attachment. |
Examples
The following example demonstrates how to access files stored in APEX_APPLICATION_FILES
and add them to an outbound email message
DECLARE l_id NUMBER; BEGIN l_id := APEX_MAIL.SEND( p_to => '[email protected]', p_from => '[email protected]', p_subj => 'APEX_MAIL with attachment', p_body => 'Please review the attachment.', p_body_html => '<b>Please</b> review the attachment'); FOR c1 IN (SELECT filename, blob_content, mime_type FROM APEX_APPLICATION_FILES WHERE ID IN (123,456)) LOOP APEX_MAIL.ADD_ATTACHMENT( p_mail_id => l_id, p_attachment => c1.blob_content, p_filename => c1.filename, p_mime_type => c1.mime_type); END LOOP; COMMIT; END; /