I am using Cordova 2.2.0 for iOS. I’m trying to implement the Phonegap EmailComposerWithAttachments plugin and I can’t seem to get the picture attachment to work.
I call:
window.plugins.emailComposer.showEmailComposerWithCallback(function(result){console.log(result);},"Look at this photo","Take a look at this:",[],[],[],true,[testPath]);
where testPath contains the path of my PNG or JPG file. e.g. ../myImage.jpg
The Good: The email composer comes up. I see my subject, the body of the e-mail etc.
The Bad: I don’t see my picture included as attachment. Instead I see a small question mark (in the emulator) and a small square (on my iPad), as if the attachment was missing.
Any ideas?
The problem was the path I was providing for the plugin.
When you get the path of a file, it looks like this:
However, the EmailComposerWithAttachments plugin does not expect the path to start with
In order for the plugin to work, you need to change its path by taking out everything before var (file:///localhost/). So, the correct path would look like this:
Then it worked. I was able to use this plugin to send emails with picture attachments.