Can you post a link with the newest OpenSSL dll's: libeay32.dll and ssleay32.dll?
The OpenSSL 3 dll's are in there too:
https://github.com/IndySockets/OpenSSL-Binaries/tree/master/openssl-3_xIf you are going to use those, you need to use ssl_openssl3 instead of ssl_openssl in your uses clause.
As dsiders stated... the version 3 has libcrypto-3-x64.dll and libssl-3-x64.dll.
The other files are for OpenSSL 1.0.2 which isn't updated anymore (and the latest are in that directory).
If I want to attach a file or two to email, how the code should be modified?
In that case... you need to construct the complete DATA segment including the attachments.
The easiest way to do that is using mimemess and mimepart from Synapse.
Here is a function to create a complete EML part (EML is the mail which you can put in the DATA part). It's also usable for directly opening in Thunderbird and Outlook program.
uses mimemess, mimepart, synachar;
function GetEMLString(const MailFrom, MailTo, Subject: string;
const MailData: TStrings; Attachments: TStrings): string;
var
Mime: TMimemess;
P: TMimePart;
S: string;
begin
Mime := TMimeMess.Create;
try
//Build a header
Mime.Header.CharsetCode := UTF_8;
Mime.header.From := MailFrom;
Mime.Header.ToList.Add(MailTo);
Mime.Header.Subject := Subject;
// Create a MultiPart part
P := Mime.AddPartMultipart('mixed', nil);
// Add as first part the mail text
Mime.AddPartTextEx(MailData, P, UTF_8, True, ME_8BIT);
// Add all attachments:
for S in Attachments do Mime.AddPartBinaryFromFile(S, P);
// Compose message
Mime.EncodeMessage;
Result := Mime.Lines.Text;
finally
Mime.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Files: TStringList;
Content: TStringList;
begin
Files := TStringList.Create;
Content := TStringList.Create;
try
Content.Add('This is the body.');
Content.Add('Files are attached.');
Files.Add('c:\temp\test2.bmp');
Memo1.Lines.Text := GetEMLString('test_from', 'test_to', 'subject', Content, Files);
// here you can use the data for sending the mail...
finally
Content.Free;
Files.Free;
end;
end;