Send an Email with an Attachment in iOS, Android, and Windows using RAD Studio - Updated 8/10/2021


We are updating our solution for this topic as some things had become outdated due to changes in Android and RAD Studio(August 10th, 2021). The solution provided here does not require any 3rd party components.


Today, I am going to share how to send emails with attachments with FireMonkey for both iOS, Android, and Windows devices.

Sending Email (with Attachment)

We have provided the file wwEmailWithAttachment.pas which you can use to send an email with an attachment. This code is compatible and has been tested with RAD Studio 10.4 Sydney. It also includes a complete project which you can compile and run. Please see below for the extra steps when deploying to an Android device

https://github.com/roywoll/wwEmailWithAttachment_fmx

This project contains a unit named wwEmailWithAttachment.pas which defines the method method wwEmail.

procedure wwEmail(
   Recipients: Array of String;
   ccRecipients: Array of String;
   bccRecipients: Array of String;
   Subject, Content,
   AttachmentPath: string;
   mimeTypeStr: string = ''); 

To use this method, add the unit wwEmailWithAttachment to your form’s uses clause (If you have FirePower installed, the use the unit name FMX.wwEmailWithAttachment instead), and then call the procedure as in the following.

wwEmail(['roywoll@gmail.com', 'royswoll@yahoo.com'],

[