Can't Install Indy Packages or Send Email By SMTP lazarus / 21-General ---------------------------------------------------------------------- AaronCatolico1 · 2024-11-08 04:35 I've been trying to install Indy SMTP and required packages. I keep getting error messages as shown in the image below. Does anyone have any instructions on how to ensure the Indy packages will be installed properly and how to send a basic email with it? I tried to install the Indy SMTP server and error messages appeared while using the Lazarus Package Manager installation wizard. I'm not quite sure what these errors are or how to fix this issue. I've even put the Indy folder directly inside of the project folder to no avail. My emailing code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,  IdSMTP, IdMessage, IdSSL, IdSSLOpenSSL; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);var  SMTP: TIdSMTP;  Email: TIdMessage;begin   SMTP := TIdSMTP.Create(nil);  Email := TIdMessage.Create(nil);  try    SMTP.Host := 'smtp.example.com';    SMTP.Port := 587;    SMTP.Username := 'your_username';    SMTP.Password := 'your_password';    SMTP.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(SMTP);    SMTP.UseTLS := utUseExplicitTLS;     Email.From.Address := 'you@example.com';    Email.Recipients.EmailAddresses := 'recipient@example.com';    Email.Subject := 'Test Email';    Email.Body.Text := 'This is a test email sent using Indy components.';     SMTP.Connect;    SMTP.Send(Email);    SMTP.Disconnect;  finally    SMTP.Free;    Email.Free;  end;end; end. ---------------------------------------------------------------------- carl_caulkett · 2024-11-08 19:15 Hi Aaron, What version of FPC and Lazarus? How were they installed - from the downloaded installers or from FpcUpDeluxe? And what OS and version number? I assume Windows from the screen shot. These details can help to narrow down the options! ---------------------------------------------------------------------- Remy Lebeau · 2024-11-08 19:41 I commented on your same question on StackOverflow: https://stackoverflow.com/questions/79170938/not-able-to-install-indy- in-lazarus-ide QuoteI know for a fact that the Indy in OPM works fine (albeit a few versions behind Indy's GitHub version). The .o files that are failing are Zlib files, and while Indy does use them, it does not load them from the path in the error messages. As for utUseExplicitTLS, it is declared in the IdExplicitTLSClientServerBase unit ---------------------------------------------------------------------- AaronCatolico1 · 2024-11-08 20:35 Lazarus 3.6 and FPC 3.2.2. I used the downloaded installers, not FPCUpDeluxe. OS is Windows 11 64-bit. Quote from: carl_caulkett on November 08, 2024, 08:15:18 pmHi Aaron, What version of FPC and Lazarus? How were they installed - from the downloaded installers or from FpcUpDeluxe? And what OS and version number? I assume Windows from the screen shot. These details can help to narrow down the options! ---------------------------------------------------------------------- carl_caulkett · 2024-11-08 20:46 Quote from: AaronCatolico1 on November 08, 2024, 09:35:45 pmLazarus 3.6 and FPC 3.2.2. I used the downloaded installers, not FPCUpDeluxe. OS is Windows 11 64-bit. Quote from: carl_caulkett on November 08, 2024, 08:15:18 pmHi Aaron, What version of FPC and Lazarus? How were they installed - from the downloaded installers or from FpcUpDeluxe? And what OS and version number? I assume Windows from the screen shot. These details can help to narrow down the options! Best you deal with Remy on this one; he's one of the Indy developers, I believe! BTW, the OPM that Remy talks about in his answers, refers to the Online Package Manager, which first needs to be installed from the Package -> Install/Uninstall Packages option, followed by an IDE rebuild. That should then put an extra Online Package Manager option on your Package menu option. Just install Indy from there 😉 ---------------------------------------------------------------------- AaronCatolico1 · 2024-11-08 20:58 I did use the OPM, as well as dumped the whole folder into my project. Still results in same errors. Quote from: carl_caulkett on November 08, 2024, 09:46:12 pmQuote from: AaronCatolico1 on November 08, 2024, 09:35:45 pmLazarus 3.6 and FPC 3.2.2. I used the downloaded installers, not FPCUpDeluxe. OS is Windows 11 64-bit. Quote from: carl_caulkett on November 08, 2024, 08:15:18 pmHi Aaron, What version of FPC and Lazarus? How were they installed - from the downloaded installers or from FpcUpDeluxe? And what OS and version number? I assume Windows from the screen shot. These details can help to narrow down the options! Best you deal with Remy on this one; he's one of the Indy developers, I believe! BTW, the OPM that Remy talks about in his answers, refers to the Online Package Manager, which first needs to be installed from the Package -> Install/Uninstall Packages option, followed by an IDE rebuild. That should then put an extra Online Package Manager option on your Package menu option. Just install Indy from there 😉 ---------------------------------------------------------------------- AaronCatolico1 · 2024-11-09 00:04 I managed to re-install everything through FPCupDeluxe and file path directories are all fixed with the new installation, however, I am still getting the error message with the "utUseExplicitTLS". What exactly did you mean by it is declared in the IdExplicitTLSClientServerBase unit? How do I do this exactly? Here's what it's showing now in the image below (as shown below and in the image): "unit1.pas(51,20) Error: Identifier not found "utUseExplicitTLS"" QuoteI know for a fact that the Indy in OPM works fine (albeit a few versions behind Indy's GitHub version). The .o files that are failing are Zlib files, and while Indy does use them, it does not load them from the path in the error messages. As for utUseExplicitTLS, it is declared in the IdExplicitTLSClientServerBase unit ---------------------------------------------------------------------- Remy Lebeau · 2024-11-09 00:19 Quote from: AaronCatolico1 on November 09, 2024, 01:04:15 amhowever, I am still getting the error message with the "utUseExplicitTLS". I already addressed that in my first comment. Quote from: AaronCatolico1 on November 09, 2024, 01:04:15 amWhat exactly did you mean by it is declared in the IdExplicitTLSClientServerBase unit? How do I do this exactly? Simply add that unit to the uses clause in your code, same as any other Pascal unit you want to use things from, eg: Code: [Select]uses   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,   IdExplicitTLSClientServerBase, IdSMTP, IdMessage, IdSSL, IdSSLOpenSSL; //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------------------------------------------------------------- AaronCatolico1 · 2024-11-09 04:09 I have added the clause to the code, but now I keep receiving these two error messages as shown in the images I've attached here: Simply add that unit to the uses clause in your code, same as any other Pascal unit you want to use things from, eg: Code: [Select]uses   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,   IdExplicitTLSClientServerBase, IdSMTP, IdMessage, IdSSL, IdSSLOpenSSL; //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  [/quote] ---------------------------------------------------------------------- AaronCatolico1 · 2024-11-09 05:32 I finally got. The problem was that I didn't know I was supposed to download and add the OpenSSL dll files directly in the project. Everything seems to be working now! Thanks again, though, Remy! ---------------------------------------------------------------------- AaronCatolico1 · 2024-11-10 00:16 How do I attach image files to the email? I've created a listbox that stores the images, loads images with openfiledialog, but not sure how to submit the images from there. Do I need to use all 3 of these; IdAttachmentFile, IdMessageParts, & IdAttachment in the uses clause? Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i // Configure the OpenDialog settings  OpenDialog1.Title := 'Select Image(s)';  OpenDialog1.Filter := 'Image Files|*.jpg;*.jpeg;*.png;*.bmp;*.gif|All Files|*.*';  OpenDialog1.Options := OpenDialog1.Options + [ofAllowMultiSelect];   // Execute the OpenDialog  if OpenDialog1.Execute then  begin    // Loop through the selected files and add their paths to the list box  for i := 0 to OpenDialog1.Files.Count - 1 do    begin      ListBox1.Items.Add(OpenDialog1.Files[i]);    end;  end;  QuoteSimply add that unit to the uses clause in your code, same as any other Pascal unit you want to use things from, eg: Code: [Select]uses   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,   IdExplicitTLSClientServerBase, IdSMTP, IdMessage, IdSSL, IdSSLOpenSSL; //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------------------------------------------------------------- Remy Lebeau · 2024-11-10 01:35 Quote from: AaronCatolico1 on November 10, 2024, 01:16:31 amHow do I attach image files to the email? Add a TIdAttachmentFile object to the TIdMessage.MessageParts collection. I suggest you read the following articles on Indy's blog: https://www.indyproject.org/2005/08/17/html-messages/ https://www.indyproject.org/2008/01/16/new-html-message-builder-class/ Quote from: AaronCatolico1 on November 10, 2024, 01:16:31 amDo I need to use all 3 of these; IdAttachmentFile, IdMessageParts, & IdAttachment in the uses clause? IdAttachmentFile will suffice. You don't need the other two unless you are declaring your own variables of those types. ---------------------------------------------------------------------- AaronCatolico1 · 2024-11-10 23:58 Thanks again, Remy! You've helped me greatly, as usual!