2 Replies Latest reply: Mar 21, 2012 7:16 AM by Vedant RSS

    Email Not Fire Show me No Data Found Error

    Vedant
      Dear All,

      i am using Apex Mail Package for sending Email.
      i want to send Email with multiple User with 5 Attachment .So for user selection i am using Shutle and for document attachment i am sung 5 File Browser Item.

      I am using Code for send Email
      DECLARE
      
      l_id number;
      to_add varchar2(1000); --P40_TO (mentioned another gmail ID)
      from_add varchar2(1000);
      l_body clob:=:P40_ACTIVITY_SUMMARY;
      l_sub varchar2(1000):=:P40_SUB;
      
      
      v_attachment BLOB; 
      v_mail_id VARCHAR2(255);
      v_filename VARCHAR2(255); 
      v_mime_type VARCHAR2 (255);
      
      v_attachment_1 BLOB; 
      v_filename_1 VARCHAR2(255); 
      v_mime_type_1 VARCHAR2 (255);
      
      v_attachment_2 BLOB; 
      v_filename_2 VARCHAR2(255); 
      v_mime_type_2 VARCHAR2 (255);
      
      v_attachment_3 BLOB; 
      v_filename_3 VARCHAR2(255); 
      v_mime_type_3 VARCHAR2 (255);
      
      v_attachment_4 BLOB; 
      v_filename_4 VARCHAR2(255); 
      v_mime_type_4 VARCHAR2 (255);
      
      
      CURSOR C1 IS select  CONTACT_EMAIL from CRM_SALES_CUSTOMER_CONTACTS where CUSTOMER_ID=:P40_ACCOUNT_ID;
      
      BEGIN
      
      select EMAIL_ID into from_add from user_mas where user_id=:app_user;
      
      
      open C1;
      LOOP
      FETCH C1 INTO to_add;
      EXIT WHEN C1%NOTFOUND;
      
        l_id:=APEX_MAIL.SEND(
              p_to        => to_add,     -- change to your email address
              p_from      => from_add,
              p_body      => l_body,
              p_body_html => l_body,
      
              P_subj      => l_sub);
      
      
      SELECT ID,FILENAME,BLOB_CONTENT,MIME_TYPE INTO v_mail_id,v_filename,v_attachment,v_mime_type 
      FROM apex_application_files  WHERE NAME=:P40_ACTIVITY_FILE;
       
      APEX_MAIL.ADD_ATTACHMENT(       p_mail_id => l_id,
                                      p_attachment => v_attachment,
                                      p_filename => v_filename,
                                      P_mime_type => v_mime_type);
      SELECT ID,FILENAME,BLOB_CONTENT,MIME_TYPE INTO v_mail_id,v_filename_1,v_attachment_1,v_mime_type_1 
      FROM apex_application_files  WHERE NAME=:P40_ACTIVITY_FILE_2;
      
      
      APEX_MAIL.ADD_ATTACHMENT(
        
                                      p_mail_id => l_id,
                                      p_attachment => v_attachment_1,
                                      p_filename => v_filename_1,
                                      P_mime_type => v_mime_type_1);
      
      SELECT ID,FILENAME,BLOB_CONTENT,MIME_TYPE INTO v_mail_id,v_filename_2,v_attachment_2,v_mime_type_2 
      FROM apex_application_files  WHERE NAME=:P40_ACTIVITY_FILE_3;
      
      APEX_MAIL.ADD_ATTACHMENT(
                                       p_mail_id => l_id,
                                      p_attachment => v_attachment_2,
                                      p_filename => v_filename_2,
                                      P_mime_type => v_mime_type_2);
      
      SELECT ID,FILENAME,BLOB_CONTENT,MIME_TYPE INTO v_mail_id,v_filename_3,v_attachment_3,v_mime_type_3 
      FROM apex_application_files  WHERE NAME=:P40_ACTIVITY_FILE_4;
      
      APEX_MAIL.ADD_ATTACHMENT(
       
                                      p_mail_id => l_id,
                                      p_attachment => v_attachment_3,
                                      p_filename => v_filename_3,
                                      P_mime_type => v_mime_type_3);
      
      SELECT ID,FILENAME,BLOB_CONTENT,MIME_TYPE INTO v_mail_id,v_filename_4,v_attachment_4,v_mime_type_4 
      FROM apex_application_files  WHERE NAME=:P40_ACTIVITY_FILE_5;
      
      
      APEX_MAIL.ADD_ATTACHMENT(
      
                                      p_mail_id => l_id,
                                      p_attachment => v_attachment_4,
                                      p_filename => v_filename_4,
                                      P_mime_type => v_mime_type_4);
      
      
      
      end loop;
      close C1;
      
      apex_mail.push_queue(
      P_SMTP_HOSTNAME => '192.168.0.6',
      P_SMTP_PORTNO => 25);
      
      END;
      all Receipient Email Address are correct but When i create Button Press then display me No data Found Error.

      How to resolve it.


      Thanks

      Edited by: Vedant on Mar 21, 2012 3:44 AM