Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidC++BuilderCode SnippetDelphiDemoFiremonkeyIOSOSXShowcaseWindows

Powerful Cross Platform Email App Sample In Delphi 10.4.1 FireMonkey For Android And IOS

Delphi FireMonkey Cross Platform Email App SourceOver 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;

Head over and download the full source code for the app on Github for Delphi 10.4.1 FireMonkey on Android and IOS.



Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
DelphiDemoFiremonkeyLinuxOSXWindows

Build Classic Desktop Operating System Themes Apps With Styles For FireMonkey

DelphiFiremonkeyIDEWindows

Easily Let AI Agents Query And Manage Your Databases Via FireDAC MCP

DelphiDemoShowcaseWindows

Build A Tiny, Explainable Language Model Entirely In Delphi

ComponentDelphiDemoFiremonkeyLibraryWindows

Run Google's Gemma 4 Vision Models Natively In Delphi

Sign up for our Newsletter and
stay informed
[mailpoet_form id="1"]