I have found a working solution for sending email with attachment using APEX application. But first, few items have to take note :-
- User can insert any attachment into the form
- The attachment will be save into my own table within the Oracle database.
CREATE TABLE ATTACHMENT_FILES
MIMETYPE VARCHAR2(255 BYTE),
FILENAME VARCHAR2(255 BYTE),
CHARSET VARCHAR2(128 BYTE),
UPLOADED_BY VARCHAR2(10 BYTE),
- Right click on [Processes] > Create
- Select [PL/SQL] and Next
- Give a name to identify the procesess and click Next (lets name it as ‘CopyFile’)
- On the [Enter PL/SQL Page Process], paste below code;
insert into ATTACHMENT_FILES( id, blob_content, mimetype, filename, last_update, doc_size )
select :P1_YOUR_ID, blob_content, mime_type, filename, created_on, doc_size from wwv_flow_files where name = :P1_ATTACHMENT;
delete from wwv_flow_files where name = :P1_ATTACHMENT;
So by now, you got the idea already right? First, we let the attachment to be saved into WWV_FLOW_FILES. Then we copied it over to our own table and delete the original data from WWV_FLOW_FILES to avoid consume space and storage.
To avoid any complex coding in PL/SQL, I believe this method is faster. It depends on your needs.
Hurmm..I will talk about sending email as Part 2 later on.
Update : This is the Part 2.