Recent

Author Topic: Synapse and ssl_openssl  (Read 691 times)

CMELIGM

  • New Member
  • *
  • Posts: 15
Synapse and ssl_openssl
« on: February 19, 2026, 08:21:39 am »
Hello,

i tried using the library ssl_openssl and the IDE told me it is deprecated and i should use ssl_openssl3. The IDE can find that unit but the compiler does not. recompiled the package, deleted the package and reinstalled it - same result. This is how the laz_synapse unit looks like:

Code: Pascal  [Select][+][-]
  1. { This file was automatically created by Lazarus. Do not edit!
  2.   This source is only used to compile and install the package.
  3.  }
  4.  
  5. unit laz_synapse;
  6.  
  7. {$warn 5023 off : no warning about unused units}
  8. interface
  9.  
  10. uses
  11.   asn1util, blcksock, clamsend, dnssend, ftpsend, ftptsend, httpsend,
  12.   imapsend, ldapsend, mimeinln, mimemess, mimepart, nntpsend, pingsend,
  13.   pop3send, slogsend, smtpsend, snmpsend, sntpsend, synachar, synacode,
  14.   synacrypt, synadbg, synafpc, synaicnv, synaip, synamisc, synaser, synautil,
  15.   synsock, tlntsend, ssl_openssl, ssl_openssl_lib;
  16.  
  17. implementation
  18.  
  19. end.
  20.  

there is no ssl_openssl3 unit here so it wont compile it ? am i missing something ?

Tried to use XMailer and i get an internal SSL error - 2026-02-18 15:45:45 - Failed Sending Email: SSL error: TSendMail

even when doing it like this:

Code: Pascal  [Select][+][-]
  1. Mail.Smtp.SSL := False;
  2.  

any help would be appreciated, thank you.

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: Synapse and ssl_openssl
« Reply #1 on: February 19, 2026, 09:57:54 am »
i tried using the library ssl_openssl and the IDE told me it is deprecated and i should use ssl_openssl3.
First you need to decide which version of OpenSSL you want to use (and possible include with your program).
If the target computer doesn't have OpenSSL 3, and you don't supply it, your program won't work.
Same goes for other OpenSSL versions.

So... which version do you use?

there is no ssl_openssl3 unit here so it wont compile it ? am i missing something ?
Where do you get that laz_synapse unit?
The latest does include ssl_openssl3.
The latest version is always in https://github.com/geby/synapse
I'm not sure what version is in the OPM of Lazarus.

Code: Pascal  [Select][+][-]
  1. { This file was automatically created by Lazarus. Do not edit!
  2.   This source is only used to compile and install the package.
  3.  }
  4.  
  5. unit laz_synapse;
  6.  
  7. {$warn 5023 off : no warning about unused units}
  8. interface
  9.  
  10. uses
  11.   asn1util, blcksock, clamsend, dnssend, ftpsend, ftptsend, httpsend,
  12.   imapsend, ldapsend, mimeinln, mimemess, mimepart, nntpsend, pingsend,
  13.   pop3send, slogsend, smtpsend, snmpsend, sntpsend, synachar, synacode,
  14.   synacrypt, synadbg, synafpc, synaicnv, synaip, synamisc, synaser, synautil,
  15.   synsock, tlntsend, ssl_openssl3, ssl_openssl3_lib, ssl_openssl;
  16.  
  17. implementation
  18.  
  19. end.

CMELIGM

  • New Member
  • *
  • Posts: 15
Re: Synapse and ssl_openssl
« Reply #2 on: February 19, 2026, 10:09:55 am »
Hi,

i did use the OPM to install it and it contains ssl3.0 units and the IDE can find it but the compiler wont.

i thought i need to include it in my unit for the XMailer Package to work but now i see that XMailer internally uses openssl. So i do not need to use openssl3 but openssl1 instead. downloaded 64 bit DLL's for ssl and put them next to my .exe. i do still get the same error in this code section of XMailer:

Code: Pascal  [Select][+][-]
  1. procedure TSendMail.Send;
  2. var
  3.   VAttempts: Byte;
  4.   VMimePart: TMimePart;
  5.   I, C, VPMax, VPPos: Integer;
  6.   VSenderAddr{$IFDEF UTF_8_MIME}, VTo, VCC, VSenderDesc{$ENDIF}: string;
  7.   VMimeMess:{$IFDEF UTF_8_MIME}TMimeMessEx{$ELSE}TMimeMess{$ENDIF};
  8.  
  9.   procedure _SetReadingConfirmation(const A: string);
  10.   begin
  11.     if FReadingConfirmation then
  12.       VMimeMess.Header.CustomHeaders.Insert(0,
  13.         'Disposition-Notification-To: ' + A);
  14.   end;
  15.  
  16. begin
  17. {$IFDEF OPEN_SSL}
  18.   if not IsAvailableOpenSSL then
  19.     raise Exception.CreateFmt('%: SSL error: %s',
  20.       [Self.ClassName, 'Could not found the SSL library.']); -> this exception will be thrown
  21. {$ENDIF}
  22.  

i attached a screenshot of my build folder.

Edit: i did also include 32 bit dll for ssl1.1 and 64 bit dll for ssl3.0

Edit2: the package i downloadedd from the OPM does not include ssl3 i think ?

the git version(.lpk) contains the following:

Code: Pascal  [Select][+][-]
  1.       </Item33>
  2.       <Item34>
  3.         <Filename Value="ssl_openssl3.pas"/>
  4.         <UnitName Value="ssl_openssl3"/>
  5.       </Item34>
  6.       <Item35>
  7.         <Filename Value="ssl_openssl3_lib.pas"/>
  8.         <UnitName Value="ssl_openssl3_lib"/>
  9.       </Item35>
  10.  

while the online package manager version(.lpk) does not include those, so i guess thats why the ide found it but the compiler did not since it got never compiled ?
« Last Edit: February 19, 2026, 10:21:47 am by CMELIGM »

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: Synapse and ssl_openssl
« Reply #3 on: February 19, 2026, 12:50:08 pm »
i attached a screenshot of my build folder.

Edit: i did also include 32 bit dll for ssl1.1 and 64 bit dll for ssl3.0

Edit2: the package i downloadedd from the OPM does not include ssl3 i think ?
You completely lost me. What's in your exe directory? How did you get those files?
Those are not OpenSSL 1.1 files. The filenames seem to be from OpenSSL 3 where you renamed the 3 to 1.1 ???

For not finding the ssl_openssl.pas in Synapse... I remember in some versions the ssl_openssl.pas isn't added to the packages. So if you just add it to your uses, it won't find it. You need to add it as requirement for your project (add the ssl_openssl.pas manually as project file) or open the laz_synapase.lpk and add the ssl_openssl.pas there. After that, the ssl_openssl.pas is found correctly.

CMELIGM

  • New Member
  • *
  • Posts: 15
Re: Synapse and ssl_openssl
« Reply #4 on: February 19, 2026, 01:32:35 pm »
Hello,

i will try to clarify it a bit better. i tried using XMailer Package to Send an Email. But it raised an Exception in this Code part:

Code: Pascal  [Select][+][-]
  1. {$IFDEF OPEN_SSL}
  2.   if not IsAvailableOpenSSL then
  3.     raise Exception.CreateFmt('%: SSL error: %s',
  4.       [Self.ClassName, 'Could not found the SSL library.']); -> this exception will be thrown
  5. {$ENDIF}
  6.  

First i thought i need to add the unit "ssl_openssl" to my uses clause for it to work. Lazarus then told me that this unit is deprecated and i should use ssl_openssl3. But that was not included in the package (Synapse) itself (From OPM) so the compiler did not find it. That is fixed for me now.

But then i found that the XMailer package uses ssl_openssl internally so i did not need ssl_openssl3 but the correct dll's for ssl_openssl. thats why i went to "https://kb.firedaemon.com/support/solutions/articles/4000121705" and downloaded "OpenSSL 1.1.1w ZIP x86+x64" and but the 64 Bit DLL inside the same Folder as my .exe. the XMailer does still throw the same Exception ("Could not found the SSL library").

I am missing something here and i do not know what. i used the same code as in the XMailer Demo with my own mailtrap credentials.

Now i did not touch XMailer anymore and tried it how it is described here: "https://wiki.freepascal.org/Synapse_-_Email_Examples". And i got it to work with SSL 1.1. i did not try it with SSl 3.
So now the function from the Wiki works but using the TSendMail class from XMailer does not.

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: Synapse and ssl_openssl
« Reply #5 on: February 19, 2026, 02:55:27 pm »
i will try to clarify it a bit better. i tried using XMailer Package to Send an Email. But it raised an Exception in this Code part:
I don't know XMailer but did you change it to expect OpenSSL 3?

First i thought i need to add the unit "ssl_openssl" to my uses clause for it to work. Lazarus then told me that this unit is deprecated and i should use ssl_openssl3. But that was not included in the package (Synapse) itself (From OPM) so the compiler did not find it. That is fixed for me now.
The fact it says it is deprecated doesn't mean it doesn't work. If the rest of your code still depends on OpenSSL 1, you can't just remove it.

But then i found that the XMailer package uses ssl_openssl internally so i did not need ssl_openssl3 but the correct dll's for ssl_openssl.
Don't MIX OpenSSL 1 and OpenSSL 3 inclusions. If XMailer uses ssl_openssl.pas or ssl_openssl1.pas, don't use OpenSSL 3 libraries (and uses in your own code).

thats why i went to "https://kb.firedaemon.com/support/solutions/articles/4000121705" and downloaded "OpenSSL 1.1.1w ZIP x86+x64" and but the 64 Bit DLL inside the same Folder as my .exe.
Woops. Yes, the files are correct for 1.1. (I looked at 1.0 which has different names).

the XMailer does still throw the same Exception ("Could not found the SSL library").
Do you still have ssl_openssl3.pas somewhere in your code? If so... it looks for OpenSSL 3, not OpenSSL 1.1.
As said... don't MIX them.

Now i did not touch XMailer anymore and tried it how it is described here: "https://wiki.freepascal.org/Synapse_-_Email_Examples". And i got it to work with SSL 1.1. i did not try it with SSl 3.
Ok.

So now the function from the Wiki works but using the TSendMail class from XMailer does not.
As far as I can see, the XMailer I found is 9 years old and uses SSL_OpenSSL. So the old 1.0 version. That one needs libeay32.dll and ssleay32.dll for OpenSSL 1.0.

So what XMailer version are you using?
If it's that old one, you would need to change it to use SSL_OpenSSL1 or SSL_OpenSSL3 depending on which OpenSSL you want to use.

CMELIGM

  • New Member
  • *
  • Posts: 15
Re: Synapse and ssl_openssl
« Reply #6 on: February 19, 2026, 03:26:59 pm »
Ah ok thank you very much,

i did use the XMailer Package from OPM. in OPM itself it said 1.0.0.0 (git: "https://github.com/MFernstrom/xmailer" - the last commit was 9 years ago).

so yes i think it is the same as you described. But i think it uses the unit from my synapse package ? when you hover over the unit then the filpath will be seen in the tooltip and that is pointing to the package synapse.40 in my Opm folder. i tried to show it in the attached screenshots. Confused about what ssl version it does use then or if the IDE is just showing something else than the compiler. i hope you understood what i meant with that  :D

anyway. now i did use the Code from the wiki which worked. updated the lpk so it will compile the ssl3 units too and then tried to use them. Now i everything works with ssl3 too. Not sure if i should try it once more with the XMailer Package ? did not know it was that old.

Many thanks ! now i do understand what was happening a lot better.

rvk

  • Hero Member
  • *****
  • Posts: 6953
Re: Synapse and ssl_openssl
« Reply #7 on: February 19, 2026, 03:45:07 pm »
Not sure if i should try it once more with the XMailer Package ? did not know it was that old.
If you try, you might want to change the uses ssl_openssl in XMailer.pas to uses ssl_openssl3 and the mentioned TSSLOpenSSL to TSSLOpenSSL3 (at 2 places in IsAvailableOpenSSL).

( maybe you need to add ssl_openssl3 to laz_synapse.lpk if that's not done already, otherwise XMailer could complain about missing directory for ssl_openssl3.pas )

For the rest... XMailer.pas is just a wrapper around TSMTPSend, so if you use TSMTPSend directly, XMailer itself isn't needed.

 

TinyPortal © 2005-2018