I would like to download email files into the cordova.file.cacheDirectory
and open them in the default email app. I am using the Cordova File Transfer Plugin for the download and the File Opener Plugin to open in the default app. The download part is working fine, however the File Opener plugin is giving the following error:
Error status: 9 - Error message: Could not handle UTI
The file I am trying to open is MIME formatted (.eml extension) and I am using the MIME type of message/rfc822
:
function openFileWithDefaultApp(fileEntry) {
var fileUrl = fileEntry.toURL();
cordova.plugins.fileOpener2.open(
fileUrl,
'message/rfc822', {
error: function (e) {
console.log(
'Error status: ' + e.status +
' - Error message: ' + e.message);
},
success: function () {
console.log('file opened successfully');
}
}
);
}
What am I missing?
P.S. This code is working perfectly with PDF files. Simply switching to email files is causing this issue. I am wondering if there is a "default app" for .eml files or do I have to switch some other format? One possibility is to convert emails to PDF, but that would loose attachments. Hence this is not preferable.