3 Replies Latest reply on Oct 27, 2017 1:36 AM by zacharyr30798184

    Contact us form on phone gap


      I'm trying to make a 'contact us' form in my app so that users can send feedback to me.

      I don't really have a server setup where I can make a form that posts data to a server so I want to make a form in html where when the user submits it generates an email with the to address, subject and body already filled in, the user simply clicks/touches 'send'.


      I am not an experienced programmer but I was trying to use cordova.plugins.email



      But have been having trouble figuring it out.


      Any help would be appreciated.

        • 1. Re: Contact us form on phone gap
          zacharyr30798184 Level 1

          Are you having trouble installing/integrating the plugin or having trouble with the api of the plugin itself inside your app?


          If you are using the Phonegap Desktop with the Phonegap developer App you will not be able to use/test this plugin as it is not a core Cordova plugin. You'll need to actually build the app with Phonegap build or cli.


          Installing plugins via npm is a little easier in my experience as you only need to reference "npm" as the plugin source in your config.xml file when you upload/build your app. You could use the npm cordova email plugin here (cordova-plugin-email ) and reference it in your config.xml as:


          <gap:plugin name="cordova-plugin-email-composer" version="0.8.3" source="npm" />


          You don't need to add any extra js files or make any other adjustments as the plugin will be added when you build the app automatically. You can call the plugin api after the device ready. You could also use the plugin you mentioned as well, as they both appear to function in similar ways.


          You could test if the npm plugin was installed with something like...



               alert'("email plugin working")



          If you can make it that far then the rest should not be too much trouble.

          • 2. Re: Contact us form on phone gap
            arona41093618 Level 1

            Thank you very much.

            If not too much trouble I'd like to run by you what I understood.



            I added this line

            <plugin name="cordova-plugin-email-composer" version="0.8.3" source="npm" />


            IN MY HTML PAGE

                <script type="text/javascript" charset="utf-8" src="./js/cordova-2.5.0.js"></script>

                <script type="text/javascript" charset="utf-8">


            // Wait for Cordova to load

            document.addEventListener('deviceready', function () {

            // cordova.plugins.email is now available

            }, false);


            MY FUNCTION

                function generateEmail() {



            var nameStr = document.getElementsByName("yourName");

            var emailAddressStr = document.getElementsByName("emailAddress");

            var subjectStr = document.getElementsByName("subject");

            var yourMessageStr = document.getElementsByName("yourMessage");



            nameStr.appendChild("<p> </p>");


            nameStr.appendChild("<p> </p>");






            to: "customerservice@paperinformant.com",

            cc: "",

            bcc: "",

            attachments: "",

            subject: subjectStr,

            body: nameStr,

            isHtml: false,

            }, callback, scope);


            • 3. Re: Contact us form on phone gap
              zacharyr30798184 Level 1

              The first goal would be to test to make sure the plugin has been loaded like I mentioned above by building the app and testing the cordova.plugin.email object. If that object does not exist you have a problem with your app package.


              You may want to experiment with the Hello World template and try to get the plugin working in that first as it is properly configured to run many plugins.