Email Composer

Improve this doc

$ ionic plugin add cordova-plugin-email-composer

Repo: https://github.com/katzer/cordova-plugin-email-composer.git

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

Supported platforms

Usage

import {EmailComposer} from 'ionic-native';


EmailComposer.isAvailable().then((available) =>{
 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
EmailComposer.send(email);

Static Methods

isAvailable(app, scope)

Verifies if sending emails is supported on the device.

Param Type Details
app string

An optional app id or uri scheme. Defaults to mailto.

scope any

An optional scope for the promise

Returns: Promise<boolean> Resolves promise with boolean whether EmailComposer is available

addAlias(alias, packageName)

Adds a new mail app alias.

Param Type Details
alias string

The alias name

packageName string

The package name

open(email, scope)

Displays the email composer pre-filled with data.

Param Type Details
email email

Email

scope any

An optional scope for the promise

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

API

Native

General