1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| PACKAGE BODY Mail_pkg IS
session_outbox OLE2.OBJ_TYPE;
session_outbox_messages OLE2.OBJ_TYPE;
message1 OLE2.OBJ_TYPE;
msg_recp OLE2.OBJ_TYPE;
recipient OLE2.OBJ_TYPE;
msg_attch OLE2.OBJ_TYPE;
attachment OLE2.OBJ_TYPE;
procedure logon( Profile IN varchar2 default NULL )is
Begin
session := ole2.create_obj('mapi.session');
args := ole2.create_arglist;
ole2.add_arg(args,Profile);
ole2.invoke(session,'Logon',args);
ole2.destroy_arglist(args);
End;
procedure logoff is
Begin
ole2.invoke(session,'Logoff');
ole2.release_obj(session);
ole2.release_obj(session_outbox);
ole2.release_obj(session_outbox_messages);
ole2.release_obj(message1);
ole2.release_obj(msg_recp);
ole2.release_obj(recipient);
ole2.release_obj(msg_attch);
ole2.release_obj(attachment);
End;
procedure send( Recp IN varchar2,
Subject IN varchar2,
Text IN varchar2,
Attch IN varchar2
)is
Begin
------C'est à ce niveau que ça bloque
session_outbox := ole2.get_obj_property(session,'outbox');
session_outbox_messages := ole2.get_obj_property(session_outbox,'messages');
message1 := ole2.invoke_obj(session_outbox_messages,'Add');
ole2.set_property(message1,'subject',Subject);
ole2.set_property(message1,'text',Text);
msg_recp := ole2.get_obj_property(message1,'Recipients');
recipient := ole2.invoke_obj(msg_recp,'add') ;
ole2.set_property(recipient,'name',Recp);
ole2.set_property(recipient,'type',1);
ole2.invoke(recipient,'resolve');
msg_attch := ole2.get_obj_property(message1,'Attachments');
attachment := ole2.invoke_obj(msg_attch,'add') ;
ole2.set_property(attachment,'name',Attch);
ole2.set_property(attachment,'position',0);
ole2.set_property(attachment,'type',1);
ole2.set_property(attachment,'source',Attch);
args := ole2.create_arglist;
ole2.add_arg(args,Attch);
ole2.invoke(attachment,'ReadFromFile',args);
ole2.destroy_arglist(args);
args := ole2.create_arglist;
ole2.add_arg(args,1);
ole2.add_arg(args,0);
ole2.invoke(message1,'Send',args);
ole2.destroy_arglist(args);
message('Génération términée. Message envoyé');
End;
END; |
Partager