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 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi FireMonkey Cross Platform Email App Source | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSOver 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
DelphiDemoFiremonkeyLinuxOSXShowcaseWindows

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging

DelphiFiremonkeyShowcaseUtilityWindows

Unleashing Creativity With Song Writer AI: A Deep Dive

DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

Leave a Reply