NativeMailExtension is a native extension to useÂ an in-app mail composer on iOS. After instantiating an object of the extension, a developer can call two methods: one to check if the extension is available for use and other to use the in-app mail composer. This last method receives several parameters, such as the message subject/body and to/cc/bcc. It’s also possible to attach files from the file system, changing its original name.
The extension also provides a set of events useful to monitor the process. Some of those events are fired when the mail was canceled, saved, sent or when something failed.
Messaging = new MailExtension(); Messaging.addEventListener(MailExtensionEvent.MAIL_COMPOSER_EVENT, onMailEvent); var fileToAttach:File = File.documentsDirectory.resolvePath('Example file.dat'); Messaging.sendMail( "Hello", "You can use HTML on the message too!", "firstname.lastname@example.org", "email@example.com", "firstname.lastname@example.org", [fileToAttach.nativePath+"|"+"text/xml"+"|"+"AttachmentFile.txt"] );