Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

[TLMDMapiSendMail] Cannot open a new mail with Outlook 360

Hello all,

In the past working with TLMDMapiSendMail I was able to attach files to a new mail using Outlook 360. The OS was Windows7 but with Windows10 it is not working. Now nothing happen.

TStringList* fileList = new TStringList();
SaveSelectedFilesToDir(GetTmpDir(), fileList);
int count = fileList->Count;

MlSnd->Attachment->Clear();
for (int i = 0; i < count; i++) {
MlSnd->Attachment->Add(fileList->Strings[i]);
}
MlSnd->SendMail();

delete fileList;


Thanks for your help
Thomas

Comments

  • 9 Comments sorted by Votes Date Added
  • I have access to installed Office 2013 on Windows 10 OS. Just checked and the component works fine. I can create a message with text and attachments.
  • Ok,
    I created a new project and these lines

    LMDMapiSendMail1->Subject = "Hello world";
    LMDMapiSendMail1->SendMail();

    Nothing happen.

    You can Download the project including the exe from 
    www.cratemaker.de/Download/Dev/Mail001.zip

    What could be the problem?
    I tested on 5 PC without success.

    Thanks
    Thomas



  • edited February 2020 Posts: 0Vote Up0Vote Down
    You exe works fine at my side. It opens Outlook and I see the mail with specified subject. 
    May be new Office versions do not support MAPI.
  • edited February 2020 Posts: 7Vote Up0Vote Down
    I have installed Office 2013 and it's not working.
    What do have installed 32 or 64Bit?

    If nothing happen like in my case your SendMail function should get an error from MAPI or?


    Another hint
    W7 with MS Office Home and Business de is working
    W10 with MS Office Prof Plus 2013 is not working

    So maybe also the office could be a problem

  • Actually, I don't know what to tell you. If you can, try to debug our source code at your side.
  • ok, please send me your exe.
    I will test on my side.
  • Since your exe worked at my side, there no much sense to send you my exe. But, if you want it:

  • The same like my exe.
    Your exe  is working with W7 but not with W10

    How you can solve the problem or what I should tell my customers?

    Thanks for your help
    Thomas 
  • >>Your exe  is working with W7 but not with W10<<
    This sounds like MAPI configuration issue. We tested on Windows 10 (Version 1909) setups which specify (always latest/last release)
    Office 2013 
    Office 2016 and
    Office 2019
    as default mail client and all worked fine (all 32bit. 64bit versions require 64bit compiled exes). 
    So please make sure that:
    * you don't run a windows version which broke MAPI functionality
    * latest Outlook 2013 is installed (some Office 2013 versions caused problems as well)
    and that MAPI is correctly configured (e.g. check Windows Messaging Subsystem  entries) to use Outlook as default client. 
    Additional useful information can be found in this similar scenario description (in german).

    To verify MAPI installation you can additionally check out the VCL built in TSendMail action (example)

    Both TLMDMapiSendMail and TSendMail offer events to extract errors during operation (OnError, OnMailSendStatus). TLMDMapiSendMail provides in addition LastError property. The LMD control provides standard MAPI error codes, TSendMail status codes are documented in help.

    When both controls fail, MAPI seems to be the problem. If TSendMail works, but TLMDMapiSendMail not: Send us all information (version numbers of all affected components, MAPI error codes) which could help us to reproduce problem. 

    BTW: If Outlook support only is required and there is no need for a generic eMail interface, you might think about using OLE automation. This simple example (without error handling etc.) demonstrates how to use it:

    uses
       ..., System.Win.ComObj;

    procedure TForm1.SendOutlookEMail;
    const
      olMailItem = 0;
    var
      Outlook: OleVariant;
      mailItem: variant;
    begin
      try
        Outlook := GetActiveOleObject('Outlook.Application');
      except
        Outlook := CreateOleObject('Outlook.Application');
      end;
      mailItem := Outlook.CreateItem(olMailItem);
      mailItem.Recipients.Add('test@test.com');
      mailItem.Subject := 'test email';
      mailItem.Body := 'This is a test';
      mailItem.Attachments.Add('C:\temp\sample.txt');  // file on your harddisk
      //mailItem.Send;   // direct send possible...
      mailItem.Display;   // displays dialog

      VarClear(Outlook);
    end;








Sign In or Register to comment.