Expo

Get Started
API Reference

MailComposer

expo-mail-composer allows you to compose and send mail quickly and easily using the OS UI. This module can't be used on iOS Simulators since you can't sign into a mail account on them.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb

Installation

expo install expo-mail-composer

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

import * as MailComposer from 'expo-mail-composer';

Opens a mail modal for iOS and a mail app intent for Android and fills the fields with provided data. On iOS you will need to be signed into the Mail app.

  • saveOptions (object) -- A map defining the data to fill the mail:
    • recipients (array) -- An array of e-mail addressess of the recipients.
    • ccRecipients (array) -- An array of e-mail addressess of the CC recipients.
    • bccRecipients (array) -- An array of e-mail addressess of the BCC recipients.
    • subject (string) -- Subject of the mail.
    • body (string) -- Body of the mail.
    • isHtml (boolean) -- Whether the body contains HTML tags so it could be formatted properly. Not working perfectly on Android.
    • attachments (array) -- An array of app's internal file uris to attach.

Resolves to a promise with object containing status field that could be either sent, saved or cancelled. Android does not provide such info so it always resolves to sent.

Determine if the MailComposer API can be used in this app.

A promise resolves to true if the API can be used, and false otherwise.
  • Returns true on iOS when the device has a default email setup for sending mail.
  • Can return false on iOS if an MDM profile is setup to block outgoing mail. If this is the case, you may want to use the Linking API instead.
  • Always returns true in the browser and on Android