如何从Oracle表单发送电子邮件

时间:2016-07-24 09:00:13

标签: oracle email

我想通过Oracle Forms 11g通过电子邮件自动发送报告。我已经实现了自动运行报告,但同时我想要附加PDF并通过电子邮件发送。我发现并尝试了这段代码但是没有用。有人可以帮帮我吗?

DECLARE

report_id REPORT_OBJECT := find_report_object('checklist'); 
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;

0 个答案:

没有答案