Home » Developer & Programmer » Forms » Mail using OLE2 Backage
Mail using OLE2 Backage [message #516813] |
Thu, 21 July 2011 01:17 |
mm_kanish05
Messages: 493 Registered: January 2007 Location: Chennai
|
Senior Member |
![mm_kanish05%40yahoo.co.in](/forum/theme/orafaq/images/yahoo.png)
|
|
Hi All,
I am using the following package and trying to send mail using .html attachment.
PACKAGE BODY Mai 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'); /* create the session object */
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 default null )is
Begin
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,'name','enq.html');
ole2.set_property(attachment,'position',400);
ole2.set_property(attachment,'type',1); -- 1 => MAPI File Data
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);
End;
END;
The above coding is sending mail perfectly but attachment file is there but no name and no extension is available.
Please help me what happened?
This is send code
[code]MAI.send(:enq_vend.e_mail,'Enquiry No : '|| :enq_head.enq_no,text_value,'D:\Enquiry.html');[code]
the html file is available in D drive also.
Please guide in this regards.
Thanks in advance.
Kanish
[Updated on: Thu, 21 July 2011 03:17] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue Sep 10 08:47:50 CDT 2024
|