Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sending mails with attachements

cardelMay 9 2008 — edited May 13 2008
I am using oracle forms 6i.
I found some examples.
Now I am able to create mail message with attachement and send it with Outlook mail client.

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 (for example Mozilla Thunderbird), not only 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?

When I execute only preview of some report, there is a button with "letter". And 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.
I would like to create similar action, but I will attach reports in PDF.

Is there any solution?

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;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 10 2008
Added on May 9 2008
2 comments
1,185 views