Ionic2: Save Image from gallery and send as attachment via mailto


#1

I am trying to save an image in my sqlite db and send it via the mailto service. Here is my code:

takepic() {
        var options = {
            quality: 80,
            destinationType: Camera.DestinationType.FILE_URI,
            sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
            allowEdit: false,
            encodingType: Camera.EncodingType.JPEG,
            saveToPhotoAlbum: false
        };
        Camera.getPicture(options).then((data) => {
            var image = document.getElementById('myImage');
            image.src = imageURI;
            this.zone.run(() => this.image = image.src);
            this.storage.query("UPDATE verifyBL SET Thu = '" + this.image + "' WHERE id = 2").then((data) => {
            }, (error) => {
                console.log("ERROR -> " + JSON.stringify(error.err));
            });
        }, (error) => {
            alert(error);
        });
    }

And when sending it via mailto it looks like:

(click)="mailIT('mailto:'+post.email +'?body=' +emailText + '&attachment='+imageSC)"

The body text will be send correctly but no attachment. I tried it with the base64 version, but no success either.