Over on Github there is a sample email client which uses IMAP and SMTP for receiving and sending mail. It has basic features like viewing, composing, and sending mail. Full source code is available and it should run on Android, IOS, OSX, Windows, and Linux. It uses the Indy library which ships with Delphi 10.4.1 for IMAP and SMTP. The Indy library for email is quite extensive but only the most basic features were added into the app because it is a sample. Indy is also available for use from C++ from within C++Builder.
The email app is a sample app which is part of the 100 cross platform samples set. It was mainly tested on Windows so there may need to be small tweaks made for it to run smoothly on the other platform. It uses TFDMemTable to store settings and the mail itself. It only took 585 lines of code to build the entire app (obviously the libraries it uses are a lot more code).
Here is some sample code which shows how simple it is to send an SMTP message via Indy:
var
LMessage: TIdMessage;
LAddress: TIdEmailAddressItem;
begin
// send
LMessage := TIdMessage.Create(nil);
try
LAddress := LMessage.Recipients.Add;
//LAddress.Name := '';
LAddress.Address := SendToEdit.Text;
//LMessage.BccList.Add.Address := '';
//LMessage.From.Name := '';
LMessage.From.Address := SendFromEdit.Text;
LMessage.Body.Text := SendMemo.Lines.Text;
LMessage.Subject := SendSubjectEdit.Text;
IdSMTP1.Host := SettingsFDMemTable.FieldByName('SmtpHost').AsString;
IdSMTP1.Port := SettingsFDMemTable.FieldByName('SmtpPort').AsInteger;
IdSMTP1.Username := SettingsFDMemTable.FieldByName('SmtpUser').AsString;
IdSMTP1.Password := SettingsFDMemTable.FieldByName('SmtpPass').AsString;
case SmtpSSLCB.ItemIndex of
-1,0: IdSMTP1.UseTLS := utNoTLSSupport;
1: IdSMTP1.UseTLS := utUseExplicitTLS;
2: IdSMTP1.UseTLS := utUseImplicitTLS;
3: IdSMTP1.UseTLS := utUseRequireTLS;
end;
IdSMTP1.Connect;
try
IdSMTP1.Send(LMessage);
finally
IdSMTP1.Disconnect
end;
finally
LMessage.Free
end;

