Check out Ionic Enterprise

Email Composer

Improve this doc

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

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

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-email
    $ npm install --save @ionic-native/email-composer
    
  2. Add this plugin to your app's module

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