I found an interesting thing...
I'm using MAPI to send emails from my application. Im using Oracle Database 9.2 and 11.2. Some time ago i have updated my oracle client to 11.2. When i used previous oracle client its was all OK, but on a new version of it MapiSendMail function return always MAPI_E_FAILURE when my OraSession object Active = True (when its not connected - its all OK).
Sounds like something mystic, but its true.
There is a code, which im using to send e-mails:
Code: Select all
function SendEmail(address, subject, body: string; attachment: TStringList): Boolean;
var
Mess : TMapiMessage;
MError : Cardinal;
File_Attachment : array of TMapiFileDesc;
Recipient : TMapiRecipDesc;
i: integer;
begin
with Mess do
begin
ulReserved := 0;
lpszSubject := PChar(subject);
lpszNoteText := PChar(body);
lpszMessageType := nil;
lpszDateReceived := nil;
lpszConversationID := nil;
flFlags := 0;
lpOriginator := nil;
FillChar(Recipient, SizeOf(Recipient), 0);
Recipient.ulRecipClass := MAPI_TO;
Recipient.lpszName := PChar(address);
nRecipCount := 1;
lpRecips := @Recipient;
SetLength(File_Attachment, Attachment.Count);
for i:= 0 to Attachment.Count-1 do
if Attachment.Strings[i]'' then
begin
FillChar(File_Attachment[i], SizeOf(File_Attachment[i]), 0);
File_Attachment[i].ulReserved := 0;
File_Attachment[i].flFlags := 0;
File_Attachment[i].nPosition := cardinal(-1);
File_Attachment[i].lpszPathName := PChar(Attachment.Strings[i]);
end;
nFileCount := Attachment.Count;
lpFiles := @File_Attachment[0];
end;
MError := MapiSendMail(0, Application.Handle, Mess, MAPI_DIALOG or MAPI_LOGON_UI, 0);
if MError 0 then MessageDlg('Error occured!', mtError, [mbOK], 0);
end;