Email Composer error


#1

Has anyone had problem with the email composer. I keeping an exception error. Does anyone have any insight?

EXCEPTION: Error: Uncaught (in promise): undefined


#2

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 :smile:


#3

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
}
});


#4

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.


#5

Hmm, seeing this as well. Could you open an issue for this on the ionic-native repo?


#6

You said that open() method is functioning. Care to share your usage.


#7

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


#8

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
            });

#9

Hello,
Does anyone have any insight?
EXCEPTION: Error: Uncaught (in promise): undefined


#10

Any solution for this problem ?


#11

I switched to the social sharing plugin which has an email method


#12

Thanks, this is the only solution we have.