0
  • Windows 7 64 bit
  • Delphi 5
  • Indy 10.6.2.5499

I know most of us have nervous ticking with this problem. But in any case I lost some hours already without result to try different ssl dlls one by one.

In every case I get my favorite "Could Not Load SSL Library" exception.

I reinstalled Indy with previously deleted old Indy and so on. I went this way more than 10 times in my life but here again...

Maybe you see some specific in my environment or so...

Code:

  SSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  SSLHandler.SSLOptions.Method := sslvTLSv1;

  FIdSMTP                 := TIdSMTP.Create(nil);
  FIdSMTP.SASLMechanisms.Clear;
  FIdSMTP.IOHandler := SSLHandler;
  FIdSMTP.AuthType := satDefault;
  FIdSMTP.UseTLS := utUseExplicitTLS;
  FIdSMTP.Host            := 'mx.freenet.de';
  FIdSMTP.Port            := 587;
  FIdSMTP.Password        := 'xxxxx';
  FIdSMTP.Username        := 'xxxxx';

  FIdMessage              := TIdMessage.Create(nil);
  FIdMessage.CharSet      := 'windows-1252';
  FIdMessage.From.Address := 'xxxxx';

  FIdMessage.ContentType := 'multipart/mixed';
  FIdMessage.subject := subject;
  FIdMessage.Recipients.EMailAddresses := email;
  FHTML := TIdText.Create(FIdMessage.MessageParts, html);
  FHTML.ContentType := 'text/html';
  FIdSMTP.ConnectTimeout := 5000;
  FIdSMTP.ReadTimeout := 5000;
  try
    FIdSMTP.Connect;
    FIdSMTP.Send(FIdMessage);
    FIdSMTP.Disconnect;
 except
    on e: Exception do
    begin
      ShowMessage(WhichFailedToLoad());
      showmessage('Cannot send mail: ' + #13 + e.Message);
    end;
  end;

  SSLHandler.Free;
  FIdSMTP.Free;
  FIdMessage.Free;
  FHTML.Free;
J...
  • 30,968
  • 6
  • 66
  • 143
mad
  • 1,029
  • 3
  • 17
  • 38
  • 3
    Have you tried this one? https://indy.fulgan.com/SSL/openssl-1.0.2s-i386-win32.zip – mjn Jun 05 '19 at 12:02
  • 3
    OpenSSL doesn't ship with Windows, so you need to make sure the two required DLLs are in your search path. I like the version from mjn's link because it excludes the dependency on the VC++ runtime. – Bruce McGee Jun 05 '19 at 13:22
  • 2
    What exactly does `WhichFailedToLoad()` report when the "could not load" error happens? On a side note, you are not setting up your `TIdMessage` correctly. Consider using `TIdMessageBuilderHtml` to help you. – Remy Lebeau Jun 05 '19 at 16:06
  • 1
    @BruceMcGee "search path" is a bit mis-leading... The term "search path" applies to the Delphi environment, but we're concerned about *outside* of Delphi. In general, the DLLs need to be in a location where the EXE can find them, whether that be in the same directory as the EXE, or in the appropriate Windows system folder (depending on x86/x64). I think it's even possible to instruct Indy to find them in a specific folder, too. – Jerry Dodge Jun 05 '19 at 23:07
  • 1
    @JerryDodge Windows search path – Bruce McGee Jun 05 '19 at 23:43
  • 2
    @JerryDodge the "search path" is more formally known as ["DLL search order"](https://learn.microsoft.com/en-us/windows/desktop/dlls/dynamic-link-library-search-order). And yes, Indy has an `IdOpenSSLSetLibPath()` function – Remy Lebeau Jun 06 '19 at 05:29
  • @mjn pls make your post as an answer. Problem was with user permission on the folder with the dlls and correct Reply address. In any case I will upvote your answer as useful for me. Thanks. – mad Jun 13 '19 at 10:10

0 Answers0