steve-jansen / cordova-ios-emailcomposer

A Cordova plugin for creating e-mail messages on iOS devices
MIT License
14 stars 4 forks source link

module emailcomposer.EmailComposer not found #8

Closed hsmith825 closed 10 years ago

hsmith825 commented 10 years ago

I installed the EmailComposer using the manual process that you outlined on Cordoval 2.9. I received the error: module emailcomposer.EmailComposer not found when I attempted the following: var emailComposer = cordova.require('emailcomposer.EmailComposer')

                           emailComposer.show({
                                              to: 'howard@flickitt.com',
                                              cc: 'howard@flickitt.com',
                                              bcc: 'howard@flickitt.com',
                                              subject: 'Example email message',
                                              body: '<h1>Hello, world!</h1>',
                                              isHtml: true,
                                              attachments: [
                                                            // attach a HTML file using a UTF-8 encoded string
                                                            {
                                                            mimeType: 'text/html',
                                                            encoding: 'UTF-8',
                                                            data: '<html><body><h1>Hello, World!</h1></body></html>',
                                                            name: 'demo.html'
                                                            },
                                                            // attach a base-64 encoded veresion of of http://cordova.apache.org/favicon.ico
                                                            {
                                                            mimeType: 'text/png',
                                                            encoding: 'Base64',
                                                            data: 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB1WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS4xLjIiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjE8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOlBob3RvbWV0cmljSW50ZXJwcmV0YXRpb24+MjwvdGlmZjpQ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PIpJv7Y7SztCM0EYvV3XX7I28w3qbFaBtUotsEKhN+2hCtjybmwwZzay07pzMSf+cSCcx/K8WXLZEV/swAAAAASUVORK5CYII=',
                                                            name: 'cordova.png'
                                                            }
                                                            // attach a file using a hypothetical file path
                                                            //,{ filePath: './path/to/your-file.jpg' }
                                                            ],
                                              onSuccess: function (winParam) { 
                                              console.log('EmailComposer onSuccess - return code ' + winParam.toString());
                                              },
                                              onError: function (error) {
                                              console.log('EmailComposer onError - ' + error.toString());
                                              }
                                              });

Thanks for any help you can provide!

Howard Howard@flickitt.com

steve-jansen commented 10 years ago

Hello @hsmith825

First apologies for my delay in response. I modified my default notification settings in GitHub to squelch a huge number of notifications when I joined a large GitHub organization for my work. I didn't realize this unsubscribed me from my own open source projects. I'm truly sorry for that.

You code sample above looks fine. My guess is your html page doesn't link to the Javascript source for the module, like these lines. The key line here is including the ../js/index.js file, which should be ~/EmailComposer.js:

        <script type="text/javascript" src="../cordova.js"></script>
        <script type="text/javascript" src="../js/index.js"></script>
        <script type="text/javascript">
            function showEmailComposer() {
                cordova.require('emailcomposer.EmailComposer').show({
                    to: 'to@example.com',

Warm regards, Steve

hsmith825 commented 10 years ago

Hi Steve,

I understand.

Thanks for getting back. I solved the problem and its been a wile so I don’t recall what the problem was.

Thanks!

Howard

From: Steve Jansen [mailto:notifications@github.com] Sent: Saturday, July 19, 2014 12:00 PM To: steve-jansen/cordova-ios-emailcomposer Cc: hsmith825 Subject: Re: [cordova-ios-emailcomposer] module emailcomposer.EmailComposer not found (#8)

Hello @hsmith825 https://github.com/hsmith825

First apologies for my delay in response. I modified my default notification settings in GitHub to squelch a huge number of notifications when I joined a large GitHub organization for my work. I didn't realize this unsubscribed me from my own open source projects. I'm truly sorry for that.

You code sample above looks fine. My guess is your html page doesn't link to the Javascript source for the module, like these lines https://github.com/steve-jansen/cordova-ios-emailcomposer/blob/master/www/EmailComposer.html#L17-L21 :

    <script type="text/javascript" src="../cordova.js"></script>
    <script type="text/javascript" src="../js/index.js"></script>
    <script type="text/javascript">
        function showEmailComposer() {
            cordova.require('emailcomposer.EmailComposer').show({
                to: 'to@example.com',

Warm regards, Steve

— Reply to this email directly or view it on GitHub https://github.com/steve-jansen/cordova-ios-emailcomposer/issues/8#issuecomment-49526777 . https://github.com/notifications/beacon/1394060__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyMTQxNTU4MCwiZGF0YSI6eyJpZCI6MzIxODAzODV9fQ==--06032c7221c0b3f2dc10e9ae0b5570058262b0db.gif

steve-jansen commented 10 years ago

@hsmith825 glad to hear it worked out!