|
Re: Through Outlook send mail & Attachment [message #86223 is a reply to message #86217] |
Mon, 13 September 2004 00:30 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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;
|
|
|
|
|
Re: Through Outlook send mail & Attachment [message #198888 is a reply to message #198878] |
Thu, 19 October 2006 00:31 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
Thanks a lot for your help, David
I just used Himanshu's code above. But I can't find the error
message now, because it runs OK now. It can send mail with attachment successfully except for a warning message
from outlook: "A program is tring to automatically send e-mail on your behalf. Do you want to allow this? ...".
It's strange that I took no special measures to solve the problem ORA-30500 but it disappeared and the program works.
Thank you ![Smile](images/smiley_icons/icon_smile.gif)
Apple
|
|
|
|
|
|
Re: Through Outlook send mail & Attachment [message #204718 is a reply to message #86217] |
Tue, 21 November 2006 19:08 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
honmsm
Messages: 2 Registered: March 2006 Location: Panama
|
Junior Member |
|
|
I have just used the code kindly provided here and it has been very useful, the emails was sended well.
The only problem I am having is the warning message ["A program is trying to automatically send e-mail on your behalf. Do you want to allow this?]
I wonder if anyone can help me to get this message eliminated.
Tkanks a lot.
|
|
|
|
|