An easy way to open an email app of the user's choice, based on the apps they have installed on their device.
Currently supported apps:
- Apple Mail
- Gmail
- Inbox
- Spark
- Airmail
- Outlook
- Yahoo Mail
- Superhuman
npm i -S react-native-email-link # or yarn add react-native-email-link
This package works with autolinking on RN>=0.60. If you're using an earlier version of React Native, please install version 1.4.0
of the library, or
check out the legacy rnpm branch.
As of iOS 9, your app needs to provide the LSApplicationQueriesSchemes
key inside
Info.plist to specify the URL schemes with which the app can interact.
Just put this in your Info.plist depending on which apps you'd like to support. Omitting these might mean that the library can't detect some of the mail apps installed by the user.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>message</string>
<string>readdle-spark</string>
<string>airmail</string>
<string>ms-outlook</string>
<string>googlegmail</string>
<string>inbox-gmail</string>
<string>ymail</string>
<string>superhuman</string>
</array>
import { openInbox } from 'react-native-email-link'
openInbox()
Text for the top of the ActionSheet or Intent.
Type | Required | Default |
---|---|---|
string | No | 'Open mail app' |
Subtext under the title on the ActionSheet
Type | Required | Default | Platform |
---|---|---|---|
string | No | 'Which app would you like to open?' | iOS |
Text for last button of the ActionSheet.
Type | Required | Default | Platform |
---|---|---|---|
string | No | 'Cancel' | iOS |
If true, not text will be show above the ActionSheet or Intent. Default value is false.
Type | Required | Default |
---|---|---|
boolean | No | false |
If true, the email Intent will be started in a new Android task. Else, the Intent will be launched in the current task.
Read more about Android tasks here.
Type | Required | Default | Platform |
---|---|---|---|
boolean | No | true | Android |
Note: openComposer()
is only available for iOS. If used with an android device, it will behave exaclty like openInbox()
. (PRs are welcomed to add Android support)
import { openComposer } from 'react-native-email-link'
openComposer()
Text for the top of the ActionSheet or Intent.
Type | Required | Default |
---|---|---|
string | No | 'Open mail app' |
Subtext under the title on the ActionSheet.
Type | Required | Default | Platform |
---|---|---|---|
string | No | 'Which app would you like to open?' | iOS |
Text for last button of the ActionSheet.
Type | Required | Default | Platform |
---|---|---|---|
string | No | 'Cancel' | iOS |
If true, not text will be show above the ActionSheet or Intent. Default value is false.
Type | Required | Default |
---|---|---|
boolean | No | false |
Recipient's email address.
Type | Required | Default |
---|---|---|
string | No | null |
Email's cc.
Type | Required | Default |
---|---|---|
string | No | null |
Email's bcc.
Type | Required | Default |
---|---|---|
string | No | null |
Email's subject.
Type | Required | Default |
---|---|---|
string | No | null |
Email's body.
Type | Required | Default |
---|---|---|
string | No | null |
This library is developed by Lean Motherfuckers, a tech consulting company like no other.
Contributors:
- Thomas Schoffelen, @tschoffelen
- César Jeanroy, @cesar3030