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:
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
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