Flutter教程

Email Composer

Contents

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

联系我们?

If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic's experts offer official maintenance, support, and integration help.

Contact Us Today!

Ionic Email Composer插件的安装(Installation)

ionic cordova plugin add cordova-plugin-email-composer npm install @ionic-native/email-composer
Ionic EE comes with fully supported and maintained plugins from the Ionic Team. Learn More or Contact Us
ionic enterprise register --key=YOURPRODUCTKEY npm install @ionic-enterprise/email-composer

Ionic Email Composer插件支持的平台(Supported Platforms)

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

Ionic Email Composer插件的用法(Usage)

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

constructor(private emailComposer: EmailComposer) { }

...


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

let email = {
  to: '[email protected]',
  cc: '[email protected]',
  bcc: ['[email protected]', '[email protected]'],
  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',
  ...
});