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

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

IOS Send Email Delphi Firemonkey | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSThe 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 );
SL: TStringList;
SL := TStringList.Create;
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' );

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

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

Unleashing Creativity With Song Writer AI: A Deep Dive


How To Build Stable Diffusion Text To Image Prompts


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


Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores

Sign up for our Newsletter and
stay informed

Leave a Reply