1

My problem is that when I use Indy to send email using Gmail it works ok in this computer where RAD Studio is installed. But when I copy my release version to different computer where is installed Windows 10 it gives an error "SSL negotiation failed"

My code is:

  lIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  lIOHandler.SSLOptions.Method := sslvTLSv1;
  lIOHandler.SSLOptions.Mode := sslmClient;

  strA := EditOsoite.Text;


  charArray[0] := ';';
  o := 0;
  IdSMTP1.IOHandler := lIOHandler;
  IdSMTP1.UseTLS := utUseRequireTLS;
   IdSMTP1.Host := 'smtp.gmail.com'; // EditPalvelin.Text;
  //IdSMTP1.Authenticate;
   // IdSMTP1.UseTLS    := utUseExplicitTLS;
      IdSMTP1.Username := EditPalvelin.Text;
  IdSMTP1.Password :=  EditSalasana.Text;
  IdSMTP1.Port := 587;

    try
     try
       IdSMTP1.Connect;
       IdSMTP1.Send(IdMessage1);
       IdMessage1.Clear;
       Sleep(1000);
       //IdMessage1.Free;
     except on E:Exception do begin
      ShowMessage('Virhe lähetettäessä');
      ShowMessage('There was an error: ' + E.Message);
      //StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message) ;
     end;
     end;

   finally
     if IdSMTP1.Connected then begin
      IdSMTP1.Disconnect;
      //IdSMTP1.Free;
      //IdMessage1.Free;
     end;
   end;
user3146414
  • 89
  • 2
  • 6
  • 2
    Did you also copy the OpenSSL DLLs to the new system? – mjn42 Oct 05 '17 at 12:12
  • Take a look at [Delphi: idHttp+SSL](https://stackoverflow.com/q/6683127/859646) – JRL Oct 05 '17 at 12:44
  • Yes I have two dll's in same directory where the application is.Those libeay32.dll and ssleay32.dll. – user3146414 Oct 05 '17 at 13:52
  • Do I have to put my dll files to system path? and how to do that if it must be there in my path? I have Windows 10. – user3146414 Oct 05 '17 at 14:27
  • No, you do not need to put the DLLs on the system path, your app folder is fine and preferred. But you do need to make sure you are using up-to-date DLLs. Are you using the latest 1.0.2 DLLs from http://indy.fulgan.com/SSL, or from somewhere else? I know for a fact that Indy works fine with Gmail, because that is what I use for testing. BTW, you should be using `UseTLS := utUseExplicitTLS` instead – Remy Lebeau Oct 05 '17 at 15:27
  • I use 1.0.2l version of OpenSSL. Now it works. I had those 64bit files and now I used i386 and now it works perfectly. Thank you! – user3146414 Oct 05 '17 at 16:36

0 Answers0