Wednesday 18 December 2013

Apex Mail with attachment process in oracle


Mail Process.

DECLARE
 l_id number;
BEGIN
    l_id := APEX_MAIL.SEND (p_to        => 'eladhanaa@gmail.com', 
                            p_from      => 'elangovanragavan@hotmail.com', 
                            p_subj      => 'APEX_MAIL with attachment',
                            p_body      => 'Please review the attachment.',
                            p_body_html => '<b>Please</b> review the attachment');    COMMIT;
END;

Attachment Process.

DECLARE
 l_id number;
BEGIN
    l_id := APEX_MAIL.SEND( p_to        => 'dhanaa@-----.com', 
                            p_from      => 'elangovan@--------.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) 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;

No comments:

Post a Comment