how to send email with ionic framework using the native email app -


so stuck trying send email ionic. tried many tutorials, examples nothing worked except one: https://blog.nraboy.com/2014/08/send-email-android-ios-ionicframework/.

i'm leaving tutorial here. please see below answer.

here how use in app.js:

.controller('emailctrl', function($cordovaemailcomposer, $scope) { $cordovaemailcomposer.isavailable().then(function() {    // available    alert("available");  }, function () {    // not available    alert("not available");  });  $scope.sendemail = function(){   var email = {      to: 'teste@example.com',      cc: 'teste@example.com',      bcc: ['john@doe.com', 'jane@doe.com'],      attachments: [        'file://img/logo.png',        'res://icon.png',        'base64:icon.png//ivborw0kggoaaaansuheug...',        'file://readme.pdf'      ],      subject: 'mail subject',      body: 'how you? nice greetings leipzig',      ishtml: true   };   $cordovaemailcomposer.open(email).then(null, function () {    // user cancelled email   });  } }); 

and here in index.html:

<button ng-click="sendemail()" class="button button-icon icon ion-email">    send mail </button> 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -