I have been attempting to send an email by using various links, but without success. I am looking for guidance on how to successfully send an email. Below is the code I have been using for sending emails. Any suggestions for changes would be greatly appreciated.
Thanks in advance :)
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title></title>
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic/js/ng-cordova.min.js"></script>
<script src="js/cordova.js"></script>
<script src="js/app.js"></script>
</head>
<body ng-app="starter" ng-controller="ExampleController">
<ion-pane>
<ion-content>
<div class="padding">
<button class="button button-icon icon ion-email" ng-click="vesitEmail()">
Send Email
</button>
</div>
</ion-content>
</ion-pane>
</body>
</html>
App.js
var example=angular.module('starter', ['ionic','ngCordova'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
});
example.controller('ExampleController', function($scope,$cordovaEmailComposer) {
$cordovaEmailComposer.isAvailable().then(function() {
// is available
alert("available");
}, function () {
// not available
alert("not available");
});
$scope.vesitEmail = function(){
var email = {
to: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f6c767b7b777a6c7731747e73787e7071747e6d5f697a6c317e7c317671">[email protected]</a>',
cc: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bed3d1d0d7cdd690d9cbcecacbfed3cddbccc8d7dddbcd90d7d0">[email protected]</a>',
bcc: null,
attachments: null,
subject: 'Mail subject',
body: 'How are you? Nice greetings from Leipzig',
isHtml: true
};
$cordovaEmailComposer.open(email).then(null, function () {
// user cancelled email
});
}
window.alert("Message Sent");
});
When attempting to test in a browser, it shows the following error :
TypeError: Cannot read property 'plugins' of undefined
Additionally, testing on a mobile phone also does not yield successful results.