Book Image

Ionic Cookbook

By : Hoc Phan
Book Image

Ionic Cookbook

By: Hoc Phan

Overview of this book

Table of Contents (18 chapters)
Ionic Cookbook
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Composing an email with an attachment from an app


Your use case may include the ability to let users compose their own email with populated fields. For example, after users perform some specific actions, the app automatically fills in the email receiver, subject, and body to have users send it off. This functionality makes it easy for users so that they don't have to manually compose the email. Many apps use this technique for the tell a friend feature.

The code example in this section will use Cordova's Email Composer plugin so that your Ionic app has a standard interface to communicate with the native device feature. You will understand how to attach files such as images to user emails. The image could be a local file in the app filesystem or Base64 string, which is a result from the device camera. The body could even contain HTML tags. Here is the screenshot of the app you are going to build:

However, keep in mind that there is no way to detect that the e-mail has been sent successfully...