1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to send email from oracle forms 11g

Discussion in 'Oracle Forms and Reports' started by shaina, Jul 24, 2016.

  1. shaina

    shaina Active Member

    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    55
    Location:
    india
    I want to automatically send a report by email through Oracle Forms 11g. I have achieved to make the report run automatically but at the same time i want the PDF to be attached and sent in email. I found and tried this code but didn't work. Can anyone help me please?

    DECLARE

    report_id REPORT_OBJECT := find_report_object('list');
    report_message VARCHAR2(100) :='';
    rep_status VARCHAR2(100) :='';
    v_error Exception;
    thelist paramlist;

    BEGIN


    thelist:= Get_Parameter_List('rep_paramlist');
    If NOT Id_Null (thelist) THEN
    DESTROY_PARAMETER_LIST(thelist);
    end if;
    thelist := Create_Parameter_List ('rep_paramlist');

    ADD_PARAMETER(thelist, 'FROM',TEXT_PARAMETER, 'shl@gmail.com');
    ADD_PARAMETER(thelist, 'SUBJECT',TEXT_PARAMETER, 'Report Attached');
    ADD_PARAMETER(thelist, 'PROJECT_NBR',TEXT_PARAMETER, 968404);


    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_COMM_MODE, SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_FILENAME, 'NEW.RDF');
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_SERVER, 'rep_calamity');
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESTYPE, MAIL );
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESFORMAT, 'PDF');
    SET_REPORT_OBJECT_PROPERTY(report_id,REPORT_DESNAME,'sm@gmail.com' );


    report_message := run_report_object (report_id, thelist);
    rep_status := report_object_status (report_message);


    begin

    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
    LOOP
    rep_status := report_object_status(report_message);
    END LOOP;
    exception
    when v_error then
    message('Error in sending Action Checklist email.'|| rep_status);
    end;
    end;
     
  2. DTSIGuy

    DTSIGuy Forum Advisor

    Messages:
    402
    Likes Received:
    58
    Trophy Points:
    410
    Location:
    Texas
    Some questions to ask yourself:
    Is RUN_REPORT_OBJECT where the command to email the report can be found?
    Is that email command available in your environment?
    Is your mail server available and/or setup to accept this?
    Are you sure you're not dealing with a firewall issue?
    Have you check your mail server log files to see if the request if even getting there?
    If there is a mail server log...does it show a problem with the message?

    HTH

    CJ