Ionic email composer plugin

I’m facing serious problem with sending an email from my ionic app.

I’m using this cordova plugin

This is my code :

Controller :

.controller('EmailController', function($scope) {
$scope.sendFeedback= function() {

    if(window.plugins && {
        window.plugins.emailComposer.showEmailComposerWithCallback(function(result) {
            console.log("Response -> " + result);
        "Feedback for your App", // Subject
        "",                      // Body
        [""],    // To
        null,                    // CC
        null,                    // BCC
        false,                   // isHTML
        null,                    // Attachments
        null);                   // Attachment Data
    else console.log("error");



    <plugin name="cordova-plugin-email" spec="^1.2.6" />
<plugin name="cordova-plugin-email-composer" spec="" />
<plugin name="com.jcjee.plugins.emailcomposer" spec="" />

The view :

  <ion-content padding="true" class="has-header">
  <button ng-click="sendFeedback()" class="button button-positive button-block">send mail</button>

When I looked to the log ,the application can't even pass through the if(window.plugins && so it shows me : console.log("error");

This exists:

I tried but it doesn’t work

What didn’t work?
What did you try?

I added the controller provided in your link and the plugin , but the problem that I can’t find the function to call on the ng click button function

Now I have the plugin available , but when I work with this controller I got the error : Cannot read property ‘email’ of undefined

This is the controller :

.controller('EmailCtrl', function($cordovaEmailComposer, $scope) {

 $cordovaEmailComposer.isAvailable().then(function() {
   // is available
 }, function () {
   // not available

 $scope.sendEmail = function(){
  if (window.cordova && {
console.log("yes yes");

var email = {
     to: '',
     cc: '',
     bcc: ['', ''],
     attachments: [

     subject: 'Mail subject',
     body: 'How are you? Nice greetings from Leipzig',
     isHtml: false

   $, function () {
   // user cancelled email


I wrestled with this plugin for ages. Save yourself the trouble and move on to a better supported one: worked for me after some setup. You may need to specify “Email only” so other facebook-like options don’t appear

Edit: email composer has in particular tendency or messing up iOS build process as well as being finicky to get working. Every build would cause trouble, trouble that we have not encountered a single time since we moved to SocialShare 4 months ago

yes it works but the problem that the user must be redirected to the gmail app ,it ll be more professionel if the email is sent directly from the app. thanks anyway

If you want to send the email straight from your Ionic app without any email client opening up, this is not the way to go and you will need to configure a server to accept the post from your app (containing the contents and meta data of the email). Whether it’s the email composer or the share plugin, it will need to make use of the device’s email client.

I’m currently working on two apps that do just this: one defers the email sending process to the device’s client (so using Share), and the other required that users don’t get sent to their personal email so it needs to contact a mail server. It took me a while to understand the different needs so I’d be happy to share what I’ve learned if you want to know more.

1 Like