Send email

Send an email from your Ionic App using one of the mail applications installed in their phone.

This functionality allows users to send an email using one of the mail applications installed in their phone. Using Email Composer plugin this functionality can be implemented successfully.

To install run:

$ ionic plugin add --save cordova-plugin-email

$ npm install --save @ionic-native/email-composer

Usage examples:

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);
sendMail(){
    //for more option please go here: http://ionicframework.com/docs/native/email-composer/
     let email = {
      to: 'contact@ionicthemes.com',
      subject: 'This app is the best!',
      body: "Hello, I'm trying this fantastic app that will save me hours of development"
    };
    // Send a text message using default options
    this.emailComposer.open(email);
  }

For more information visit the plugin documentation: https://ionicframework.com/docs/native/email-composer/

Last updated