Sending mails with attachements [message #317951] |
Mon, 05 May 2008 01:44 |
cardel
Messages: 21 Registered: April 2008
|
Junior Member |
|
|
I found some examples on this forum.
Now I am able to create mail message with attachement.
But I have 2 problems...
1) in my code I use
OutlookApp := OLE2.CREATE_OBJ('Outlook.Application');
But I would like to execute default mail client, not Outlook.
2) if I create new message a display it, the message format is RTF. Can I change message format to HTML or plain-text?
Thanks for some tips...
My code is:
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(200);
Begin
var1 := 'Test message from REports';
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','abc@test.com');
OLE2.SET_PROPERTY(mailItem,'Subject','Sample message from forms');
OLE2.SET_PROPERTY(mailItem,'Body', 'Hi'||var1);
--add an attachment
Attachments := OLE2.GET_OBJ_PROPERTY(mailItem,'Attachments');
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'c:\temp\temp.pdf');
Attachment_dummy := OLE2.INVOKE_OBJ(Attachments,'add',OLEPARAM);
OLE2.DESTROY_ARGLIST(OLEPARAM);
OLE2.INVOKE(mailItem,'Display');
--destroy objects
OLE2.RELEASE_OBJ(mailItem);
OLE2.RELEASE_OBJ(NameSpace);
OLE2.RELEASE_OBJ(OutlookApp);
END;
|
|
|
|
Re: Sending mails with attachements [message #318300 is a reply to message #318230] |
Tue, 06 May 2008 07:32 |
cardel
Messages: 21 Registered: April 2008
|
Junior Member |
|
|
Yes, I have searched whole forum.
I can´t send mails directly using some programs like sendmail, or package utl_smtp.
I need to invoke windows default mail client with predefined address, added attachement etc..
When I execute only preview of some report, there is a button with "letter". A this button execute some action, which is the action that I need. It opens default mail client, create new message and add report as attachement into it.
|
|
|
|
|
|
Re: Sending mails with attachements [message #318961 is a reply to message #318765] |
Thu, 08 May 2008 09:29 |
cardel
Messages: 21 Registered: April 2008
|
Junior Member |
|
|
It is nice, that I can read something about Mozilla Thunderbird, but I dont want to read something. I cant make some program, that will be orieted only for Thinderbird or Outloook or some other mail client. I want to call some method (maybe some windows api, or ole2 package) and open default mail client. This solution must then open Outlook, or Thunderbird or some other mail client, that will be configured as default.
utl_tcp or utl_smtp need some others informations (smtp server address, user account, password etc..) But I dont want to do it this way.
I want to execute something, that oracle reports have build in now. Execute the same action that is executed if I push button with letter in report preview.
I think taht ole2 is right way, but I have to find out how to call default mail client and not only Outlook
|
|
|
|