How to launch native email with an image


#1

I have a modal with a canvas in it. How do I launch an email with the canvas as email body?

I see a couple of email plugins but they seem to launch a composer. In particular I do not want my app to need access to the user’s contacts.

Thanks


#2

not possible. AFAIK there is no plugin which lets you do this. its better to use some API to send an email if you don’t want to use user accounts.


#3

Thanks.

As an alternative, is it possible to copy a canvas image into clipboard? I tried copying the dataUrl but doesn’t seem to paste in gmail composer.


#4

OK, so I suppose this is perhaps the best option. I tried this plugin

https://github.com/katzer/cordova-plugin-email-composer/blob/cab303d/README.md

And the code is very straightfoward:

 var img_data = $scope.canvas.toDataURL("image/png");
 var options = { attachments: [ $scope.canvas.toDataURL("image/png") ], 
          subject: 'Enjoy!', body: 'See', isHtml: true};
 $cordovaEmailComposer.open(options);

Which asks which email app to use. But it does not attach the picture to email, says “Couldn’t attach file.” in gmail, and just nothing in outlook.

What am I missing? Thanks.


#6

Really, there is no one who can shed light on how to get the image attachment going on an Android?!

I have tried with image type “image/png” as well as “image/jpeg” , both have same outcome