Error while connecting files using the PhoneGap EMailComposer plugin
I am using the Phonegap plugin EMailComposer from Android to send an attachment, but when the mail client (gmail app) opens, I always get the same "file cannot be attached" error.
This is the code I am using:
cordova.plugins.email.open({
to: 'XX',
subject: 'XX',
body: 'XX',
attachments: '//file.csv'
});
I'm sure the path is correct, because when I use any other file path, the error changes to "the attached file cannot be empty".
I am using cordova CLI 4.0.0 and plugin version 0.8.2. I tested it in Android 4.4.2 and 4.2.1
Any idea?
+3
source to share
1 answer
As per the documentation, you need to use
attachments: 'file:///storage/sdcard/icon.png', //=> Android
but it didn't work for me, so I tried without storage
and it works for me. (I'm using Android 5.1.1 for my tests, so I don't know if this works in your case for Android 4.x)
Try:
attachments: 'file:///sdcard/file.csv
+1
source to share