Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

add a ReplyTo or From in a mail using OLE2 in Forms 6

Status
Not open for further replies.

lecorr

Programmer
Apr 9, 2003
62
FR
Hi,

I am doing a form to automatically send mails (I use forms because I do Excel docs using OLE to link them to the mails...). It works but the From and ReplyTo properties.
My code is:
Code:
FUNCTION Send_a_mail( Recp IN varchar2,
CopyTo IN varchar2,
CopyHidden IN varchar2,
MailFrom IN varchar2,
Subject IN varchar2,
Text IN varchar2,
Attch IN varchar2,
dialog IN number ) RETURN NUMBER
IS
objOutlook OLE2.OBJ_TYPE;
objMail OLE2.OBJ_TYPE;
objArg OLE2.LIST_TYPE;
objAttach OLE2.OBJ_TYPE;

BEGIN
-- Connect to  Outlook
objOutlook := OLE2.CREATE_OBJ('Outlook.Application');

-- Create the Mail
objarg := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(objarg,0);
objMail := OLE2.INVOKE_OBJ(objOutlook,'CreateItem',objarg);
OLE2.DESTROY_ARGLIST(objarg);

IF Attch IS NOT NULL THEN
-- Attach 1 file
objAttach := OLE2.GET_OBJ_PROPERTY(objmail, 'Attachments');
objarg := OLE2.CREATE_ARGLIST; 
OLE2.ADD_ARG(objarg, Attch ); -- filename
OLE2.INVOKE(objattach, 'Add', objarg); 
OLE2.DESTROY_ARGLIST(objarg);
END IF;

-- Addresses
IF MailFrom IS NOT NULL THEN
OLE2.SET_PROPERTY(objmail,'From',MailFrom);
OLE2.SET_PROPERTY(objmail,'ReplyTo',MailFrom);
END IF;
OLE2.SET_PROPERTY(objmail,'To',Recp);
IF CopyTo IS NOT NULL THEN
OLE2.SET_PROPERTY(objmail,'Cc',CopyTo);
END IF;
IF CopyHidden IS NOT NULL THEN
OLE2.SET_PROPERTY(objmail,'Bcc',CopyHidden);
END IF;

OLE2.SET_PROPERTY(objmail,'Subject',Subject);
OLE2.SET_PROPERTY(objmail,'HTMLBody',NVL(Text,' '));

-- Send
IF dialog = 1 THEN
OLE2.INVOKE(objmail, 'Display');
ELSE
OLE2.INVOKE(objmail, 'Send');
END IF;

-- Free ressources
OLE2.RELEASE_OBJ(objmail);
OLE2.RELEASE_OBJ(objOutlook);
return 0;

END;

Because I have no docs, I used Bcc, CC... and it works, so I thougth 'From' and 'ReplyTo' should work too, but it doesn't.

Has any one a hint, or the true knowledge of this?

Thanks a lot.

Christian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top