Has anyone had problem with the email composer. I keeping an exception error. Does anyone have any insight?
EXCEPTION: Error: Uncaught (in promise): undefined
Has anyone had problem with the email composer. I keeping an exception error. Does anyone have any insight?
EXCEPTION: Error: Uncaught (in promise): undefined
Could you share some code for what you are trying to do?
We need some more information, not just the error message, to help you out
I am using the code from the docs and get that code. I would like to mention I am on beta 7 and it looks like it might have something todi with zonejs
import {EmailComposer} from ‘ionic-native’;
EmailComposer.isAvailable().then((available) =>{
if(available) {
//Now we know we can send
}
});
Not sure if this is completely related but in beta 7 the isAvailable() method doesn’t work for me, it always exits with the catch statement. In beta 6 I used the same code which worked correctly.
EmailComposer.isAvailable().then((available) =>{
if(available) {
//Now we know we can send
}
}).catch(() => {
console.log('EmailComposer.isAvailable error');
});
I’ve tested this on a Samsung s4 and a Samsung s6 and both devices fail.
I would like to point out it only seems to be the isAvailable() method that has this problem. If i comment it out and just call the EmailComposer.open()
method it works as expected.
Hmm, seeing this as well. Could you open an issue for this on the ionic-native repo?
You said that open() method is functioning. Care to share your usage.
According to a reply I received on the issue I opened it looks like the issue might be with the plugin itself. I used a different plugin, cordova-plugin-email, and I was able to get it to work using just the open method. I tested the isAvailable method, did get the error, but the available param is undefined.
Other plugin Git - https://github.com/hypery2k/cordova-email-plugin.git
Here is a snippet from my code for EmailComposer.open()
:
EmailComposer.open({
to: 'recepient@fakeemail.com',
cc: null,
bcc: null,
attachments: null,
subject: 'Test subject',
body: 'Test body, kind regards Testy McTester',
isHtml: false
});
Hello,
Does anyone have any insight?
EXCEPTION: Error: Uncaught (in promise): undefined
Any solution for this problem ?
I switched to the social sharing plugin which has an email method
Thanks, this is the only solution we have.
You need to include it in the providers array in your app.module.ts file. As usual, this is not mentioned anywhere in the docs.
If anyone is still having trouble with this, you need to include it in the providers array in your app.module.ts file. As usual, this is not mentioned anywhere in the docs.
It’s at the bottom of this page.
I stand corrected, however I still believe It should have been mentioned on the actual documentation page for Email Composer as this is what the vast majority of user’s will be using as a reference when trying to implement it. It is a crucial step and the plugin will not work without it.