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;