Home » Developer & Programmer » Forms » Multiple attachments to a mail through Forms 6I
Multiple attachments to a mail through Forms 6I [message #81519] Wed, 26 February 2003 21:56 Go to next message
Avinash Pai
Messages: 23
Registered: February 2003
Junior Member
Dear friends !!!

I have been working on an ERP and am facing a problem while creating a mail in Microsoft Outlook through Forms 6I. Basically I would like to attach multiple attachments to the mail generated by the following procedue code in Forms 6I. My procedure is as follows,

PROCEDURE DESPDOC_EMAIL
(VTO IN VARCHAR2,
VCC IN VARCHAR2,
VBCC IN VARCHAR2,
VSUB IN VARCHAR2)
IS
OutlookApp OLE2.OBJ_TYPE;
NameSpace OLE2.OBJ_TYPE; -- documents collection
Folders OLE2.OBJ_TYPE;
MailItem OLE2.OBJ_TYPE;
MailItem2 OLE2.OBJ_TYPE;
OLEPARAM ole2.list_type;
Send OLE2.OBJ_TYPE;
Attachments OLE2.OBJ_TYPE;
Attachment_dummy OLE2.OBJ_TYPE;
v_to varchar2(500) := VTO;
v_cc varchar2(500) := VCC;
v_body varchar2(2000) := 'TEST MAIL';
v_bcc varchar2(500) := VBCC;
v_subject varchar2(200) := 'Despatch details';
BEGIN
OutlookApp := OLE2.CREATE_OBJ('Outlook.Application');

-- Create a namespace
-- Think of this as the equivalent as the Documents Collection
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'MAPI');
NameSpace := OLE2.INVOKE_OBJ(OutlookApp,'GetNameSpace',OLEPARAM);
OLE2.DESTROY_ARGLIST( OLEPARAM );

--Create a newMail Object
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,0);
MailItem := OLE2.INVOKE_OBJ(OutlookApp,'CreateItem',OLEPARAM);
OLE2.DESTROY_ARGLIST( OLEPARAM );

-- Show the new message box. - Dont do when MAILING straight Through
MailItem2 := OLE2.INVOKE_OBJ(Mailitem,'Display');
ole2.set_property(MailItem,'To',v_to);
ole2.set_property(MailItem,'CC',v_cc);
ole2.set_property(MailItem,'BCC',v_bcc);
ole2.set_property(MailItem,'Subject',v_subject);
ole2.set_property(MailItem,'Body',v_body);

Attachments := OLE2.GET_OBJ_PROPERTY(MailItem,'Attachments');

--Adding an attachment
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'K:EMAILDESPDOC_20316_TBM--DA-W012256.HTM');
Attachment_dummy := OLE2.INVOKE_OBJ(Attachments,'add',OLEPARAM);
OLE2.DESTROY_ARGLIST( OLEPARAM );

/*
--Automatically send mail
--Send := OLE2.INVOKE_OBJ(Mailitem,'Send');
*/

OLE2.RELEASE_OBJ( MailItem );
OLE2.RELEASE_OBJ( NameSpace );
OLE2.RELEASE_OBJ( OutlookApp );
END;

Kindly note that "K:EMAILDESPDOC_20316_TBM--DA-W012256.HTM" is one of the file attachments to the mail created. How do I go about for adding more attachments ?

Pls let me know if anyone of u can help me out ? Its very urgent & crucial.

Looking forward for a positive response.

Best regards,
Avinash Pai
Re: Multiple attachments to a mail through Forms 6I [message #81528 is a reply to message #81519] Thu, 27 February 2003 02:50 Go to previous messageGo to next message
magnetic
Messages: 324
Registered: January 2003
Senior Member
--Adding NEXT attachment
OLEPARAM := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(OLEPARAM,'next.HTM'');
Attachment_dummy := OLE2.INVOKE_OBJ(Attachments,'add',OLEPARAM);
OLE2.DESTROY_ARGLIST( OLEPARAM );

write this block for every next attachment
only the filename is different everytime
Finally sent the mail
Re: Multiple attachments to a mail through Forms 6I [message #81549 is a reply to message #81519] Sat, 01 March 2003 04:59 Go to previous message
Avinash Pai
Messages: 23
Registered: February 2003
Junior Member
hi magnetic !!!

sorry for delay in reply as i was out of Bombay.

thanx a lot for ur help. i had tried it earlier but without creating / destroying the arglist each time for a new attachment.

looking forward for any help in future.

bye for then.

best regards,
avinash pai
Previous Topic: Re: Serial Ports
Next Topic: Rental store repository export file
Goto Forum:
  


Current Time: Thu Apr 25 03:59:14 CDT 2024