Need help with react-native-email-link?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

flexible-agency
142 Stars 39 Forks MIT License 136 Commits 2 Opened issues

Description

📭 Open an email client from React Native (for 'magic link' type functionality).

Services available

!
?

Need anything else?

Contributors list

React Native Email Link

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

Installation

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.

A note about iOS 9+

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.

LSApplicationQueriesSchemes

    message
    readdle-spark
    airmail
    ms-outlook
    googlegmail
    inbox-gmail
    ymail
    superhuman

Usage

openInbox

import { openInbox } from 'react-native-email-link'

openInbox()

Arguments

title

Text for the top of the ActionSheet or Intent.

| Type | Required | Default | | -------- | -------- | --------------- | | string | No | 'Open mail app' |

message

Subtext under the title on the ActionSheet

| Type | Required | Default | Platform | | -------- | -------- | ----------------------------------- | -------- | | string | No | 'Which app would you like to open?' | iOS |

cancelLabel

Text for last button of the ActionSheet.

| Type | Required | Default | Platform | | -------- | -------- | --------- | -------- | | string | No | 'Cancel' | iOS |

removeText

If true, not text will be show above the ActionSheet or Intent. Default value is false.

| Type | Required | Default | | -------- | -------- | -------- | | boolean | No | false |

newTask

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 |

Example

import { openInbox } from 'react-native-email-link'

openInbox({ message: 'Whatcha wanna do?', cancelLabel: 'Go back!' })

openComposer

import { openComposer } from 'react-native-email-link'

openComposer()

Arguments

title

Text for the top of the ActionSheet or Intent.

| Type | Required | Default | | -------- | -------- | --------------- | | string | No | 'Open mail app' |

message

Subtext under the title on the ActionSheet.

| Type | Required | Default | Platform | | -------- | -------- | ----------------------------------- | -------- | | string | No | 'Which app would you like to open?' | iOS |

cancelLabel

Text for last button of the ActionSheet.

| Type | Required | Default | Platform | | -------- | -------- | --------- | -------- | | string | No | 'Cancel' | iOS |

removeText

If true, not text will be show above the ActionSheet or Intent. Default value is false.

| Type | Required | Default | | -------- | -------- | -------- | | boolean | No | false |

to

Recipient's email address.

| Type | Required | Default | | -------- | -------- | -------- | | string | No | null |

cc

Email's cc (iOS only).

| Type | Required | Default | | -------- | -------- | -------- | | string | No | null |

bcc

Email's bcc (iOS only).

| Type | Required | Default | | -------- | -------- | -------- | | string | No | null |

subject

Email's subject.

| Type | Required | Default | | -------- | -------- | -------- | | string | No | null |

body

Email's body.

| Type | Required | Default | | -------- | -------- | -------- | | string | No | null |

encodeBody

Apply

encodeURIComponent
to the email's body.

| Type | Required | Default | | ------- | -------- | ------- | | boolean | No | false |

Example

import { openComposer } from 'react-native-email-link'

openComposer({ to: '[email protected]', subject: 'I have a question', body: 'Hi, can you help me with...' })

Authors

This library is developed by Lean Motherfuckers, a tech consulting company like no other.

Contributors:

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.