Send mail with Outlook Express, not Microsoft Outlook (FORMS 6i)
604678Jan 30 2008 — edited Jan 30 2008Hi, I have this code for send mails in forms 6i but the messages are sent by Microsoft Outlook and I want to send that in Outlook Express. How can I do that??
I read that OLE object are for Microsoft Outlook, Excel, Word... but not Outlook Express, but... How can I do that with the Outlook express... send a email with attachment or only make the mail and put in the mailbox??
---=== THE CODE ===---
PROCEDURE Send_Outlook_Mail (
p_recipient IN varchar2,
p_subject IN varchar2,
p_body IN varchar2,
p_attachment IN varchar2
)IS
happlication OLEOBJ;
hmailitem OLEOBJ;
hrecipients OLEOBJ;
hrecipient OLEOBJ;
hattachments OLEOBJ;
hattachment OLEOBJ;
BEGIN
--message('SE LO ENVIO AL MAIL -> '||p_recipient);Message(' ');
-- THIS SEND THE MAILS WITH MICROSOFT OUTLOOK ... XXXXXXXXX
hApplication := CREATE_OLEOBJ('Outlook.Application',TRUE);
--
-- Create a new Mail Item
--
INIT_OLEARGS(1); /* The CreateItem method just takes one argument
*/
ADD_OLEARG(0); /* The value equivalent to olMailItem */
hMailItem := CALL_OLE_OBJ(hApplication,
GET_OLE_MEMBERID(hApplication,'CreateItem'));
--
-- Add a Subject to the mail message
--
SET_OLE(hMailItem,GET_OLE_MEMBERID(hMailItem,'Subject'),p_subject) ;
--
-- Add Body Text to the mail message
--
SET_OLE(hMailItem,GET_OLE_MEMBERID(hMailItem,'Body'),p_body);
--
-- Geta handle to the Recipients collection
--
hRecipients := GET_OLE_OBJ(hMailItem,GET_OLE_MEMBERID(hMailItem,'Recipients'));
--
-- Call the Add method of Recipients to create a new Recipient
--
INIT_OLEARGS(1);
ADD_OLEARG(p_recipient);
hRecipient := CALL_OLE_OBJ(hRecipients,GET_OLE_MEMBERID(hRecipients,'Add'));
--
--Set the Type property for this Recipient to "TO"
-- the Type TO for a Mail recipient is of value 1
-- the Type CC for a Mail recipient is of value 2
--
SET_OLE(hRecipient, GET_OLE_MEMBERID(hRecipient,'Type'),1);
--
-- Geta handle to the Attachments collection
--
hAttachments := GET_OLE_OBJ(hMailItem,GET_OLE_MEMBERID(hMailItem,'Attachments'));
--
-- Call the Add method of Attachments to create a new Attachment
--
INIT_OLEARGS(1);
ADD_OLEARG(p_attachment);
hRecipient := CALL_OLE_OBJ(hAttachments, GET_OLE_MEMBERID(hAttachments,'Add'));
--
-- Save the newly created Mail Message
--
INIT_OLEARGS(0); /* No args for this Method BUT we must declare that */
CALL_OLE(hMailItem,GET_OLE_MEMBERID(hMailItem,'Save'));
--
-- Send the Mail Message
--
INIT_OLEARGS(0); /* No args for this Method BUT we must declare that
*/
CALL_OLE(hMailItem, GET_OLE_MEMBERID(hMailItem,'Send'));
Message('Mail sent sucessfully ');Message('');
--
END;