Mail por Forms 6i

Tengo este procedimiento para enviar mails por forms, pero solo consigo adjuntar un documento, no dos que es lo que quiero hacer realmente. Los ficheros que quiero adjuntar los envio por parametros, son adjunto1 y adjunto2 .
¿Puedes decirme como adjuntar los dos ficheros? Tambien tengo la duda sobre el parametro "De", o sea el email del que esta enviando el correo, ya que no aparece, he pensado incluir un parametro igual que hago con el "to", pidiendolo en el form pero no se si hay alguna forma automatica para que coja directamente la cuenta predeterminada en outlook.
Bueno, te escribo el procedimiento. Gracias por leerme
PROCEDURE enviarmail (adjunto1 varchar2 ,adjunto2 varchar2)IS
objOutlook OLE2.OBJ_TYPE;
objMail OLE2.OBJ_TYPE;
objArg OLE2.LIST_TYPE;
objAttach OLE2.OBJ_TYPE;
BEGIN
objOutlook := OLE2.CREATE_OBJ('Outlook.Application');
objarg := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(objarg,0);
objMail := OLE2.INVOKE_OBJ(objOutlook,'CreateItem',objarg);
OLE2.DESTROY_ARGLIST(objarg);
objAttach := OLE2.GET_OBJ_PROPERTY(objmail, 'Attachments');
objarg := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(objarg,adjunto1||';'||adjunto2);
OLE2.SET_PROPERTY(objmail,'To',:para);
OLE2.SET_PROPERTY(objmail,'Subject',:asunto);
OLE2.SET_PROPERTY(objmail,'Body',:texto);
OLE2.INVOKE(objattach, 'Add', objarg);
OLE2.INVOKE(objmail,'Send');
OLE2.INVOKE(objmail,'Display');
OLE2.RELEASE_OBJ(objmail);
OLE2.RELEASE_OBJ(objOutlook);
OLE2.DESTROY_ARGLIST(objarg);
Message('Su email ha sido creado correctamente, conectese a Outlook para enviarlo.');
Message('Su email ha sido creado correctamente, conectese a Outlook para enviarlo.');
EXCEPTION
WHEN OTHERS THEN
MESSAGE('No se ha podido enviar el email,lo siento');
MESSAGE('No se ha podido enviar el email,lo siento');
END;
1

1 Respuesta

64.225 pts. Diego Rodrigo Munoz Herrera, de 34 anios de edad,...
Pucha,
Voy a investigarlo.
A ver que te encuentro.
Sorry!
Purpose
=======
This note describes how to send email from a Form running via a
internet browser. You cannot use MS Exchange in the Web Environment
because of OLE limitations in Web Forms; this article describes
an alternative.
Scope and Applications
======================
This article is appropriate for all developers and support analysts.
It applies to 3-tier architecture only and works for all versions of
Forms Server that have Web Functionality.
How to Send Email in Web Deployed Forms
=======================================
Use WEB. SHOW_DOCUMENT to call a URL that provides email capability
from your browser. An example of this is clicking on an email contact
such as a "mailto:emailaddress" link, and bringing up a new mail message
from the browser.
Example
=======
Create a button on a new canvas. Add a WHEN-BUTTON-PRESSED trigger that
contains the following code:
Web.show_document('mailto:emailid','_blank');
Now run the form from a browser. When you click on the button, a new
instance of your browser is invoked. This initiates a new Mail message
dialog. From the screen, you can use your internet mail as normal,
adding attachments if necessary.
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('Re cp '||p_recipient);Message(' ');
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_MEMBE RID(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_OLEAR GS(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_MEMBE RID(hRecipient,'Type'),1);
--
-- Geta handle to the Attachments collection
--
hA ttachments := GET_OLE_OBJ(hMailItem,GET_OLE_MEMBERID(hMailItem,'Attachments'));
--
-- Call the Add method of Attachments to create a new Attachment
--
INIT_OLEA RGS(1);
ADD_OLEARG(p_attachment);
hRecipient := CALL_OLE_OBJ(hAttachments, GET_O
LE_MEMBERID(hAttachments,'Add'));
--
-- Save the newly created Mail Message
--
I NIT_OLEARGS(0); /* No args for this Method BUT we must declare that */
CALL_OLE( hMailItem,GET_OLE_MEMBERID(hMailItem,'Save'));
--
-- Send the Mail Message
--
IN IT_OLEARGS(0); /* No args for this Method BUT we must declare that
*/
CALL_OLE(hMailItem, GET_OLE_MEMBERID(hMailItem,'Send'));
Message('Mail sent suce ssfully ');Message('');
--
END;
Create a sample form with the following fields :
1. RECIPIENT
2. Subject
3. Body
4. Attachment
create one push but ton and in the When-Button-Pressed trigger call this
procedure
Send_Outlook_M ail (:Recipient, :Subject, :Body, :Attachment);
Create the Procedure Send_Outlo ok_Mail in the Program Units of the form.
Configure the Outlook express before using this Form

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas