Email Composerβ

Improve this doc

This plugin is still in beta stage and may not work as expected. Please submit any issues to the plugin repo.

$ ionic plugin add cordova-plugin-email
$ npm install --save @ionic-native/email-composer

Repo: https://github.com/hypery2k/cordova-email-plugin

Requires Cordova plugin: cordova-plugin-email-composer. For more info, please see the Email Composer plugin docs.

DISCLAIMER: This plugin is experiencing issues with the latest versions of Cordova. Use at your own risk. Functionality is not guaranteed. Please stay tuned for a more stable version. A good alternative to this plugin is the social sharing plugin.

Supported platforms

Usage

import { EmailComposer } from '@ionic-native/email-composer';

constructor(private emailComposer: EmailComposer) { }

...


this.emailComposer.isAvailable().then((available: boolean) =>{
 if(available) {
   //Now we know we can send
 }
});

let email = {
  to: 'max@mustermann.de',
  cc: 'erika@mustermann.de',
  bcc: ['john@doe.com', 'jane@doe.com'],
  attachments: [
    'file://img/logo.png',
    'res://icon.png',
    'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...',
    'file://README.pdf'
  ],
  subject: 'Cordova Icons',
  body: 'How are you? Nice greetings from Leipzig',
  isHtml: true
};

// Send a text message using default options
this.emailComposer.open(email);

Instance Members

isAvailable(app)

Verifies if sending emails is supported on the device.

Param Type Details
app string

App id or uri scheme.Optional

Returns: Promise<any> Resolves if available, rejects if not available

addAlias(alias, packageName)

Adds a new mail app alias.

Param Type Details
alias string

The alias name

packageName string

The package name

open(options, scope)

Displays the email composer pre-filled with data.

Param Type Details
options EmailComposerOptions

Email

scope any

Scope for the promiseOptional

Returns: Promise<any> Resolves promise when the EmailComposer has been opened

EmailComposerOptions

Param Type Details
app string (optional)
to string | Array<string> (optional)
cc string | Array<string> (optional)
bcc string | Array<string> (optional)
attachments Array<any> (optional)
subject string (optional)
body string (optional)
isHtml boolean (optional)

API

Native

General