Thanks in advance.......
Following is my Apex Page Submit Process in Apex 20.1.
------------------------------------------------------------
DECLARE
l_mailid NUMBER;
l_report BLOB;
BEGIN
BEGIN
l_report :=
APEX_UTIL.get_print_document (
p_application_id => 28062,
p_report_query_name => 'QRERROR',
p_report_layout_name => 'LYTQRERROR',
p_report_layout_type => 'rtf',
p_document_format => 'pdf',
p_print_server => 'https://apex.oracle.com/pls/apex');
EXCEPTION
WHEN OTHERS
THEN
Proc_Ins_Error_Log (SQLCODE, SQLERRM));
END;
BEGIN
INSERT INTO TBL\_TEST\_BLOB (T\_BLOB, T\_REMARKS)
VALUES (
l\_report,
'Inserted from apex.oracle.com. Date and Time:'
|| TO\_CHAR (SYSDATE, ' Mon DD, RRRR HH:MIam'));
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
Proc\_Ins\_Error\_Log (SQLCODE, SQLERRM));
END;
l\_mailid :=
APEX\_MAIL.SEND (
p\_to => 'xxxxxxx@gmail.com',
p\_from => 'info@xyzcompany.com',
p\_subj => 'APEX\_MAIL Apex.Oracle.Com. test subject';
p\_body => 'dis is test email.',
p\_body\_html => '\<b>Please\</b> review the attachment. Date Time:'
|| TO\_CHAR (SYSDATE, 'RR-MM-DD HH24:MI:SS'));
APEX_MAIL.ADD_ATTACHMENT (
p_mail_id => l_mailid,
p_attachment => l_report,
p_filename => TO_CHAR (SYSDATE, 'RRMMDDHH24MISS')
|| 'OracleApexDotCom.pdf',
p_mime_type => 'application/pdf');
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
Proc_Ins_Error_Log (SQLCODE, SQLERRM));
END;
/
The mail successfully sent wif an attachment but the attachment can't open / show invalid pdf file.
But when me sent the attachment from my blob column it has no errors. And my query print report successfully wif rtf layout on button click.
My Question Is "How can I send an email from database with attachement from '.rtf' report format"?