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.