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

AppmethodCode SnippetComponentDelphiFiremonkeyIOS

Send Email On IOS Using Delphi XE5 Firemonkey

IOS Send Email Delphi FiremonkeyThe D.P.F Delphi iOS Native Components by b_yaghobi on the Sourceforge repository provides components for composing/sending emails using Delphi XE-4 and XE-5 on the iOS target platform. Sending an email is as simple as dropping a TDPFMailCompose component on a FIreMonkey mobile application form and calling the MailCompose method. The component package comes with a demo (MailCompose) to demonstrate how this works, but i have included the two important code snippets for your review. The first is the send mail button’s OnClick event which calls the MailCompose method passing it the information gathered from the other controls on the form. The next is the send status event, which fills a label on the form with the status of the sent message.
procedure TFMailCompose.DPFButtonSendMailClick( Sender: TObject );
var
SL: TStringList;
begin
SL := TStringList.Create;
try
SL.Add( 'This is a sample attachment file content. create by TDPFMailCompose' );
SL.SaveToFile( GetTempDirectory + 'DPFSampleAttach.txt' );
if not DPFMailCompose1.MailCompose( DPFTextFieldSubject.Text, DPFTextViewBody.Text, False, [DPFTextFieldRecipient.Text], [], [], [GetTempDirectory + 'DPFSampleAttach.txt'] ) then
ShowMessage( 'Sorry' + #10#13 + 'You cant send eMail '#10#13 + '1) Your Device not support eMail Compose' + #10#13 + '2) You not have a Mailbox' );
finally
SL.Free;
end;
end;

procedure TFMailCompose.DPFMailCompose1SendStatus( Sender: TObject; Result: Integer );
const
StatusMessage: array [0 .. 3] of string = ( 'MailCompose Cancelled', 'MailCompose Saved', 'MailCompose Sent', 'MailCompose Failed' );
begin
DPFLabel1.Text := StatusMessage[Result];
end;

Stop on over to SourceForge and download the D.P.F Delphi iOS Native Components and starting sending email messages from your Delphi iOS applications today.

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

Related posts
ComponentDelphiFiremonkeyUtilityWindows

Bring OpenClaw-Style AI Agents To Delphi And Object Pascal

C++BuilderDelphiFiremonkeyIDEUtility

Build And Design Delphi FireMonkey Apps With AI Inside RAD Studio

DelphiUtilityWindows

Give AI Agents A Searchable Map Of Firemonkey APIs And Examples

DelphiFiremonkeyLibraryLinuxOSXWindows

Run ONNX Models, Local AI, And GPU Inference Directly From Firemonkey

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

Leave a Reply