如何通过离子应用程序发送电子邮件

时间:2016-06-08 10:57:53

标签: cordova ionic-framework cordova-plugins hybrid-mobile-app ngcordova

我想从离子应用程序发送邮件,但代码无效。 使用this link

安装在插件下方

下面是我的控制器代码



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

  $scope.sendFeedback = function(){
    cordova.plugins.email.isAvailable(
      function (isAvailable) {
        // alert('Service is not available') unless isAvailable;
        cordova.plugins.email.open({
          to:      'test@xyz.com',
          cc:      'jane@doe.com',
          subject: 'Feedback',
          body:    'This app is awesome'
        });
      }
    );
  };

  $scope.sendContactMail = function() {
    alert("sendContactMail call");
    //Plugin documentation here: http://ngcordova.com/docs/plugins/emailComposer/

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

   alert("Not available");
 });

  var email = {
    to: 'abhay.sharma@ratufa.com',
    cc: 'admin@ingredientapp.info',
    bcc: ['admin@ingredientapp.info'],
    subject: 'Cordova Icons',
    body: 'How are you? Nice greetings from Leipzig',
    isHtml: true
  };

 $cordovaEmailComposer.open(email).then(null, function () {
   // user cancelled email
   alert("Email Not compose");
 });
 alert("mail send");

  };

})




这是我的HTML



<div class="send-email">
        <button class="button button-outline button-block featured" ng-controller="EmailSenderCtrl" ng-click="sendContactMail()">
          Send us an email
        </button>
      </div>
&#13;
&#13;
&#13; $ cordovaEmailComposer 出现问题时显示不可用。 请帮我修理一下。谢谢

0 个答案:

没有答案