Home » Developer & Programmer » Forms » another time (outlook express)
another time (outlook express) [message #86228] Mon, 13 September 2004 03:26 Go to next message
ala
Messages: 17
Registered: May 2004
Junior Member
hi

I want to send an email with attached file by using outlook expressob

form 6i.

so , whet I want is

   1- how to add attached files on the mail.

    2- how to send the mail automaticlly with out viewing the out look express screen to the users.

regards

ala
Re: another time (outlook express) [message #86248 is a reply to message #86228] Wed, 15 September 2004 00:28 Go to previous message
Himanshu
Messages: 457
Registered: December 2001
Senior Member
Hi,
Try this code.

HTH
Regards
Himanshu

DECLARE

OutlookApp OLE2.OBJ_TYPE;
NameSpace OLE2.OBJ_TYPE;
MailItem OLE2.OBJ_TYPE;
OLEPARAM OLE2.LIST_TYPE;
Send OLE2.OBJ_TYPE;
Attachments OLE2.OBJ_TYPE;
Attachment_dummy OLE2.OBJ_TYPE;
var1 varchar2(100);

Begin

--assign a value to the variable from the Oracle Form
-- var1 := :BLOCK5.txt5;

--but for testing, populate the variable 'by hand'
var1 := 'This is a test of Outlook from Oracle app.';

OutlookApp := OLE2.CREATE_OBJ('Outlook.Application');

OLEPARAM := OLE2.CREATE_ARGLIST;

OLE2.ADD_ARG(OLEPARAM,'MAPI');
NameSpace := OLE2.INVOKE_OBJ(OutlookApp,'GetNameSpace',OLEPARAM);
OLE2.DESTROY_ARGLIST(OLEPARAM);

OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,0);
MailItem := OLE2.INVOKE_OBJ(OutlookApp,'CreateItem',OLEPARAM);
OLE2.DESTROY_ARGLIST(OLEPARAM);

OLE2.SET_PROPERTY(MailItem,'To','himan_bharadwaj@hotmail.com');
OLE2.SET_PROPERTY(MailItem,'Subject','message testing Outlook
automation from Oracle');
OLE2.SET_PROPERTY(MailItem,'Body', 'hello again '||var1);

--add an attachment
Attachments := OLE2.GET_OBJ_PROPERTY(MailItem,'Attachments');
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'C:chris_school.txt');
Attachment_dummy := OLE2.INVOKE_OBJ(Attachments,'add',OLEPARAM);
OLE2.DESTROY_ARGLIST(OLEPARAM);

Send := OLE2.INVOKE_OBJ(MailItem,'Send');

--destroy objects
OLE2.RELEASE_OBJ(MailItem);
OLE2.RELEASE_OBJ(NameSpace);
OLE2.RELEASE_OBJ(OutlookApp);

END;
Previous Topic: UPPERCASE in Combo Box
Next Topic: display the user information on status bar
Goto Forum:
  


Current Time: Sun May 19 10:18:26 CDT 2024