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

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 );
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.

Exit mobile version