Home » Developer & Programmer » Forms » Sending mails with attachements (Forms6i, WinXP)
Sending mails with attachements [message #317951] Mon, 05 May 2008 01:44 Go to next message
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 #318230 is a reply to message #317951] Tue, 06 May 2008 03:01 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
have you reviewed all the other email threads in this forum? Search for 'create_obj'.

Also look at:
Sending emails
http://www.orafaq.com/forum/m/173406/67467/?srch=email+file#msg_173406
-a newer one
http://www.orafaq.com/forum/t/57136/67467/
Also
http://www.orafaq.com/forum/t/81053/67467/
Using Orasend
http://www.experts-exchange.com/Databases/Oracle/Q_10332809.html

David
Re: Sending mails with attachements [message #318300 is a reply to message #318230] Tue, 06 May 2008 07:32 Go to previous messageGo to next message
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 #318444 is a reply to message #318300] Tue, 06 May 2008 19:55 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What is the name of your default mail client?

David
Re: Sending mails with attachements [message #318646 is a reply to message #318444] Wed, 07 May 2008 07:55 Go to previous messageGo to next message
cardel
Messages: 21
Registered: April 2008
Junior Member
I am using Mozilla Thunderbird
Re: Sending mails with attachements [message #318765 is a reply to message #318646] Wed, 07 May 2008 22:30 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I googled 'mozilla Thunderbird' and got an impressive range of Mozilla sites. At http://www.mozilla.org/projects/thunderbird/ there is a link to their Forum. Google also gave a link to Wikipedia http://en.wikipedia.org/wiki/Mozilla_Thunderbird

I am not going to read all this stuff for you but in there is the information you need.

I would have thought you could use 'utl_smtp' or 'utl_tcp' and just point to the Mozilla Thunderbird server. Doesn't it have a name that you can put in to the 'open_connection' statement?

David
Re: Sending mails with attachements [message #318961 is a reply to message #318765] Thu, 08 May 2008 09:29 Go to previous messageGo to next message
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


Re: Sending mails with attachements [message #319084 is a reply to message #318961] Fri, 09 May 2008 00:28 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Karel,

Unfortunately, look through the registry to find the default email server and use that information in the connect statement.

David
Previous Topic: tree in lov
Next Topic: get operating system user
Goto Forum:
  


Current Time: Fri Dec 09 00:24:49 CST 2016

Total time taken to generate the page: 0.14311 seconds