ngCordova email plugin

Hi all,
I follow this plugin:

http://devdactic.com/sending-emails-with-images-in-ionic-cordova/

but when I send an email my gmail is crashes and the email is not sent,
at first test it work but on the other tests it stop working.
why?
It don’t work without images attached, too

I try again with this feature and I decide to post here my code:

the app.js

angular.module('starter', ['ionic', 'ngCordova', 'starter.controllers', 'starter.services'])


.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }
  });
})

Probably in the if I must include the window.cordova.plugins.composeEmail?

the controller.js

.controller('AccountCtrl', function($scope, $cordovaCamera, $cordovaFile) {
  $scope.settings = {
    enableFriends: true
  };
  $scope.composeEmail = {};
  $scope.images = [];
  $scope.takePicture = function() {
    var options = {
      destinationType : Camera.DestinationType.FILE_URI,
      sourceType : Camera.PictureSourceType.CAMERA,
      allowEdit : false,
      encodingType : Camera.EncodingType.JPEG,
      popoverOptions : CameraPopoverOptions,
    };
    $cordovaCamera.getPicture(options).then(function(imageData) {
      onImageSuccess(imageData);
      function onImageSuccess(fileURI) {
        createFileEntry(fileURI);
      }
      function createFileEntry(fileURI) {
        window.resolveLocalFileSystemURL(fileURI, copyFile, fail);
      }
      function copyFile(fileEntry){
        var name = fileEntry.fullPath.substr(fileEntry.fullPath.lastIndexOf('/') + 1);
        var newName = makeid() + name;
        window.resolveLocalFileSystemURL(cordova.file.dataDirectory, function(fileSystem2) {
          fileEntry.copyTo(fileSystem2,newName,onCopySuccess,fail);
        },
        fail);
      }
      function onCopySuccess(entry) {
        $scope.$apply(function() {
          $scope.images.push(entry.nativeURL);
        });
      }
      function fail(error) {
        console.log("fail: " + error.code);
      }
      function makeid() {
        var text = "";
        var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        for (var i = 0; i < 5; i++) {
          text += possible.charAt(Math.floor(Math.random() * possible.length));
        }
        return text;
      }
    }, function(err) {
      console.log(err);
    });
  }
  $scope.urlForImage = function(imageName) {
    var name = imageName.substr(imageName.lastIndexOf('/') + 1);
    var trueOrigin = cordova.file.dataDirectory + name;
    return trueOrigin;
  }
  $scope.sendEmail = function() {
    var namefrom = $scope.composeEmail.namefrom;
    var subject = $scope.composeEmail.subject;
    var bodytext = $scope.composeEmail.bodytext;
    var bodytext = namefrom + "<br>" + bodytext;
    if (null != $scope.images) {
      var images = [];
      var savedImages = $scope.images;
      for (var i = 0; i < savedImages.length; i++) {
        images.push("" + $scope.urlForImage(savedImages[i]));
        images[i] = images[i].replace('file://', '');
      }
      window.plugin.email.open({
        to: ["francescopassanante@gmail.com"],
        cc: null,
        bcc: null,
        attachments: images,
        subject: subject,
        body: bodytext,
        isHtml: true,
      }, function() {
        console.log('email view dismissed');
      },
      this);
    }
  }
})

.controller('PriceCtrl', function($scope) {});

in the controller I try to include $cordovaEmailComposer beetwen $scope and $cordovaCamera but if I write it there the screen that cointains the controller doesn’t work. If I remove $cordovaEmailComposer from the controller it work (another issue).

Can you help me please?
Thanks

ok, the gmail or other services for sending email are stopped only when the image was attached, and the attached image doesn’t show into email message… the preview is doesnt show. it shows only the box but without preview. probably an error on the saving of image? in my store of the phone i dont find the image that i capture into my app…