Page 1 of 1

MapiSendMail + OraSession.Active = MAPI_E_FAILURE (Oracle Client 11.2)

Posted: Wed 01 Sep 2010 05:58
by Infomaster
Hi.
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;
As a say, when there is no active OraSession in my application - its all OK, but when is not - i have an error message (only on client 11.2. 9.2 works fine).

Posted: Wed 01 Sep 2010 12:00
by AlexP
Hello,


I could not reproduce the problem.

I tried to send an e-mail with active OraSession and all worked.
I tested it on Windows XP SP3, Delphi 2009, Oracle server 9.2 and 11.1, Oracle client 11.2, ODAC 6.90.0.60, Outlook Express.

Please send me the following information so that I could test this behaviour again
- the exact version of your ODAC;
- the exact version of your IDE;
- the exact version of your OS;
- the name and exact version of your Mail Client;

Also you can refer to the http://forums.oracle.com/forums/thread. ... dID=606204 topic, may be will help you