Search docs/
Getting StartedPlugins

Email Composer

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

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

Premier Version Available

Featuring regular release cycles, security and bug fixes, and guaranteed SLAs.

Available here

インストール

ionic cordova plugin add cordova-plugin-email-composernpm install @ionic-native/email-composernpm install cordova-plugin-email-composernpm install @ionic-native/email-composerionic cap sync
Ionic Native Enterprise はIonic Teamが完全にサポートしメンテナンスしているプラグインを利用できます。 詳しくみる か、エンタープライズプラグインに興味があれば 連絡ください

サポートしているプラットフォーム

  • Amazon Fire OS
  • Android
  • Browser
  • iOS
  • Windows
  • macOS

利用方法

React

See here.

Angular

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

constructor(private emailComposer: EmailComposer) { }

...


this.emailComposer.getClients().then((apps: []) => {
   // Returns an array of configured email clients for the device
});

this.emailComposer.hasClient().then(app, (isValid: boolean) => {
 if (isValid) {
   // Now we know we have a valid email client configured
   // Not specifying an app will return true if at least one email client is configured
 }
});

this.emailComposer.hasAccount().then((isValid: boolean) => {
 if (isValid) {
   // Now we know we have a valid email account configured
 }
});

this.emailComposer.isAvailable().then(app, (available: boolean) => {
 if(available) {
   // Now we know we can send an email, calls hasClient and hasAccount
   // Not specifying an app will return true if at least one email client is configured
 }
});

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);

You can also assign aliases to email apps

// add alias
this.email.addAlias('gmail', 'com.google.android.gm');

// then use alias when sending email
this.email.open({
  app: 'gmail',
  ...
});