cordova email composer

361 views
Skip to first unread message

Doc Jump

unread,
Jul 15, 2016, 8:28:51 PM7/15/16
to phonegap
I am attempting to use the cordova email composer and followed the instructions for installing it, i.e., from the cli :
cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git. 
I then attempt to use the plugin in two different ways like so:

cordova.plugins.email.open(); for a blank email and

cordova.plugins.email.open({
to: 'geo...@cyberwurks.com',
subject: 'Database',
body: 'Database Attached'});
for a pre-filled email draft. Neither example works. In fact, the code immediately
following the above doesn't get executed. It somehow simply
bypasses the remainder of code in the function where this code is used. According
to WebStorm, "email" is an "uresolved variable"? Any ideas will be greatly appeciated.

Regards,

jcesarmobile

unread,
Jul 16, 2016, 3:56:45 AM7/16/16
to phonegap
How are you testing the app?

Doc Jump

unread,
Jul 16, 2016, 2:02:31 PM7/16/16
to phon...@googlegroups.com

I am testing on an Android smartphone with confirms, etc.


On Jul 16, 2016 12:57 AM, "jcesarmobile" <jcesar...@gmail.com> wrote:
How are you testing the app?

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com
---
You received this message because you are subscribed to a topic in the Google Groups "phonegap" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phonegap/UHJ97uKowu8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mharr

unread,
Jul 18, 2016, 11:16:02 AM7/18/16
to phonegap
Have you waited until deviceready has fired?

Doc Jump

unread,
Jul 18, 2016, 1:34:41 PM7/18/16
to phon...@googlegroups.com

Yes


--

Doc Jump

unread,
Jul 19, 2016, 2:53:37 PM7/19/16
to phonegap
I found the below code snippet online:

    $cordovaEmailComposer.isAvailable.then(function(){confirm("Available")},function(){confirm("not available")});
    confirm("before blank email open");
    cordova.plugins.email.open();
confirm("before email.open");
    cordova.plugins.email.open({
        to: 'geo...@gmail.com',

        subject: 'Database',
        body: 'Database Attached'});
//        attachments:'dbfile.txt'});
confirm("after email.open");
Unlike the original example I posted here, this one allows execution to continue all the way through the code. However, the isAvailable always returns false which implies that no email
has been setup on the android device. !
I am using a Samsung Galaxy S6 edge which certainly has email already set up in the form of gmail.
Anyone have a clue about this? Thanks.


On Friday, July 15, 2016 at 5:28:51 PM UTC-7, Doc Jump wrote:
I am attempting to use the cordova email composer and followed the instructions for installing it, i.e., from the cli :
cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git. 
I then attempt to use the plugin in two different ways like so:

cordova.plugins.email.open(); for a blank email and

cordova.plugins.email.open({

Doc Jump

unread,
Jul 19, 2016, 7:45:40 PM7/19/16
to phonegap
I finally got it to work. Even though isAvailable is always false, if the "app" parameter is added, the email succeeds. This segment of code shows the implementation:

    cordova.plugins.email.open({
        app: 'gmail',
        to: 'geo...@cyber.com',

        subject: 'Database',
        body: 'Database Attached'});
where "app:'gmail', specifies that I want to use the gmail email client. The documentation for the cordova email composer mentions that this parameter can be used but gives no indication that it might be mandatory, but it is the only way I could get the composer to work.
Regards,


On Friday, July 15, 2016 at 5:28:51 PM UTC-7, Doc Jump wrote:

Kerri Shotts

unread,
Jul 20, 2016, 11:32:54 AM7/20/16
to phonegap
I'm going to suggest filing a bug on that on the plugin's repo. Either the documentation needs to be clarified, or the plugin may be acting in a way that's not intended.

My concern with specifying the app is this: what happens if that client is not installed on the device? You'll want to test that out in your app.

Doc Jump

unread,
Jul 20, 2016, 11:23:52 PM7/20/16
to phon...@googlegroups.com

Thanks Kerri. I will submit a bug report later when i have the time. This issue has put me behind schedule and i need to wrap up this project first.


On Jul 20, 2016 8:33 AM, "Kerri Shotts" <kerri...@gmail.com> wrote:
I'm going to suggest filing a bug on that on the plugin's repo. Either the documentation needs to be clarified, or the plugin may be acting in a way that's not intended.

My concern with specifying the app is this: what happens if that client is not installed on the device? You'll want to test that out in your app.

Doc Jump

unread,
Jul 27, 2016, 2:13:32 PM7/27/16
to phonegap
I filed a bug report with katzer/cordova-plugin-email-composer.git. Here is the response to that report fyi. Regards

Sent: Wednesday, July 27, 2016 8:29 AM
Subject: Re: [katzer/cordova-plugin-email-composer] email composer needs 'app' and isAvailable always false. (#225)

The thing is if you check the code for android. IsAvaialble checking two things.
1. If you have configured the default mail client.
2. If there is any application which support mail service.

And it return both two values isPossible , withSchema respectively.

So it should work if you have configured default mail client.

I fixed this according to my need you can find it
https://github.com/hunnysharma102/cordova-plugin-email-composer.git




On Friday, July 15, 2016 at 5:28:51 PM UTC-7, Doc Jump wrote:

Kerri Shotts

unread,
Jul 28, 2016, 11:51:38 AM7/28/16
to phonegap
Good to know; thanks for reporting back!
Reply all
Reply to author
Forward
0 new messages