Avatar of formi
formi
Flag for Switzerland

asked on 

simple mapi timeout

Hi

Delphi XE7
Outlook 2013

I have writen a function to send EMails with simple mapi and that works
  OutlookApplication1.Connect;
  MailSent := false;
  try
    MailItem1 := OutlookApplication1.CreateItem(olMailItem)  as MailItem;
    if toAdress <> '' then
      MailItem1.Recipients.Add(toAdress);
    MailItem1.CC := ToCC;
    MailItem1.BCC := ToBCC;
    MailItem1.Subject := Subject;
    if AttachedFileNames <> nil then
    begin
      for i := 0 to AttachedFileNames.Count - 1 do
        MailItem1.Attachments.Add(AttachedFileNames[i], EmptyParam, EmptyParam, EmptyParam);
    end;
    MailAktiv := True;
    MailItem1.Display(true);
  finally
    //MailItem1.Close(olSave); //Disconnect;
    OutlookApplication1.Disconnect;
    Result := MailSent;
  end;

Open in new window


In event ItemSent of tOutlookApplication I set the boolean MailSent to true to notify that the email is sent. If I send the email within <1 minute it works. If I send the email with a delay of > 1 minute the ItemSent-event is not fired. How can I solve this problem? Thanks.
Delphi

Avatar of undefined
Last Comment
formi

8/22/2022 - Mon