[Lazarus] Email sending program using Indy stopped working - seems to be an SSL problem

Bo Berglund bo.berglund at gmail.com
Mon Jan 15 08:32:59 CET 2024


On Sat, 13 Jan 2024 00:54:59 +0100, Bo Berglund via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>I wrote a commit reporting application for Windows Server16 back in 2018 using
>then current Lazarus/Fpc.
>It is a command line program called from a hook in subversion to distribute the
>log message and details of commits among co-workers.
>
>It uses Indy 10.6.2 to do its job.
>The mailer class has these in uses:
>  {Indy units:}
>  IdSMTP,
>  IdMessage,
>  IdEMailAddress,
>  IdIOHandler,
>  IdIOHandlerSocket,
>  IdIOHandlerStack,
>  IdSSL,
>  IdSSLOpenSSL,
>  IdExplicitTLSClientServerBase,
>  IdMessageBuilder,
>
>Back mid-december 2023 the emails stopped arriving but the problem was not
>discovered/reported until I myself recently did a commit and I did not get the
>expected log message email...
>
>Now I have looked in the logfiles the application creates and found this error
>example:
>
>20240111 17:13:35.343 Connecting to mailserver
>20240111 17:13:36.590 EXCEPTION: In SendSvnMessage = Error connecting with SSL.
>error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
>
>My development system is a Windows 10 x64 PC...

FINALLY:
--------
After I posted on the Atozed forum I received a reply where a by me previously
unknown configuration item for TIdSSLIOHandlerSocketOpenSSL was suggested:

constructor TSvnMessage.Create;
begin
  FSvnUsers := TSvnUsers.Create;
  FSubscription := TStringList.Create;
  FSMTP := TIdSMTP.Create(nil);

  FSSLHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
  //Add this to set the scope of SSL versions allowed:
  FSSLHandler.SSLOptions.SSLVersions := [sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2];

  FMailMessage := TIdMessage.Create(nil);
end;

This single line in the code for my mailer made it resume operations toward the
changed mail server!

Posting here in case someone wonders in the future about how to fix it.

Issue closed.


-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list