Skip to main content
Question

Sending a database-stored attachment via email

  • April 2, 2025
  • 1 reply
  • 19 views

Forum|alt.badge.img+7
  • Sidekick (Customer)
  • 39 replies

 

Hi everyone,

I want to send a PDF file attached in the "Attachments" section of the IFS 10 application to a user via email. Here are the steps I followed, but I was unsuccessful.  Why am I getting this error? What alternative approach can I take? I would appreciate your help.

  1. I retrieved the BLOB data of the relevant attachment using the query:
    SELECT k.file_data FROM edm_file_storage

  2. I wrote a function that returns this value.

    CREATE OR REPLACE FUNCTION Get_Oq_File_Data(
        INQUIRY_NO_ IN VARCHAR2, 
        REVISION_NO_ IN VARCHAR2

    RETURN BLOB IS
        v_file_data BLOB;  
    BEGIN
        SELECT t.file_data 
        INTO v_file_data
        FROM Doc_Reference_Object_tab d
        JOIN Edm_File_Tab e ON e.doc_class = d.doc_class 
                            AND e.doc_no = d.doc_no 
                            AND e.doc_sheet = d.doc_sheet
                            AND e.doc_rev = d.doc_rev
        JOIN EDM_FILE_STORAGE_TAB t ON e.doc_class = t.doc_class
                                     AND e.doc_no = t.doc_no
        WHERE e.doc_type = 'ORIGINAL'
          AND d.key_ref like %'INQUIRY_NO=' || INQUIRY_NO_ || 
                          '^REVISION_NO=' || REVISION_NO_%
          AND d.doc_class = 'FATURA'
          AND d.lu_name = 'QuotationOrder'
          AND ROWNUM =1 ;

     

        RETURN v_file_data;

     

    EXCEPTION
        WHEN NO_DATA_FOUND THEN
            RETURN NULL;
        WHEN OTHERS THEN
            RAISE;
    END Get_Oq_File_Data;

  3. I used this function in the email trigger to send the email.

At this stage, I encountered an error in the form of    "Error while sending data...
Caused by: javax.mail.MessagingException: IOException while sending message
Caused by: java.io.FileNotFoundException: .pdf (The system cannot find the file specified)"

1 reply

Mathias Dahl
Superhero (Employee)
Forum|alt.badge.img+32
  • Superhero (Employee)
  • 2875 replies
  • April 2, 2025

I think you are leaving out the details on how you have set up the e-mail sending for us to comment. It looks like the system is looking for a file (perhaps you asked it to be included in the e-mail?) and cannot find it. Which file is this? How did you try to save it there? Etc.

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings