Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

APEX_MAIL.ADD_ATTACHMENT not working

BaonergesJun 18 2015 — edited Jul 6 2015

I am using APEX_MAIL to send emails and I am using ADD_ATTACHMENT to attach files stored by the file browser as BLOBs in tables. The email sends with the text but there is no attachment on the email. Any ideas as to why? I have read multiple other forums all with no answer to this.

APEX_MAIL.ADD_ATTACHMENT stopped working after 4.2 upgrade This archived discussion suggests the error is an apex 4.2 bug of some sort since it did not occur prior.

My code is below. This code sends an email with NO attachment. Any help is appreciated.

DECLARE

    l_id NUMBER;

BEGIN

    l_id := APEX_MAIL.SEND(

        p_to        => 'apex@apex.com',

        p_from      => 'apex@apex.com',

        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 = 2568915681598084) 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;

This post has been answered by Baonerges on Jul 6 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2015
Added on Jun 18 2015
5 comments
1,475 views