Hi all,
I try to send an e-mail with an attachment that I capture with Camera.
I created two function: takePicture and sendEmail
first capture the Image and second will send this image on an e-mail
first function:
$scope.takePicture = function() {
var options = {
quality : 75,
destinationType : Camera.DestinationType.DATA_URL,
sourceType : Camera.PictureSourceType.CAMERA,
allowEdit : true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 300,
targetHeight: 300,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
$cordovaCamera.getPicture(options).then(function(imageData) {
$scope.imgURI = "data:image/jpeg;base64," + imageData;
}, function(err) {
// An error occured. Show a message to the user
});
};
second function
$scope.sendEmail = function() {
if(window.plugins && window.plugins.emailComposer) {
window.plugins.emailComposer.showEmailComposerWithCallback(function(result){
console.log("Response ->" + result);
},
"Feedback for your App", //Subject
"Body of feedback", //Body
["francescopassanante@gmail.com"], //To field
null, //CC
null, //BCC
false, //isHTML
null, //Attachments
null); //Attachments Data
}
};
the HTML is
for show image
<img ng-show="imgURI !== undefined" ng-src="{{imgURI}}">
for send image
<button class="button button-block button-large button-positive icon-right ion-paper-airplane" ng-click="sendEmail()">Invia</button>
now I would that I can put the image in the email, how can I do this?
Thanks