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
Post a Comment