0
votes

I am working on VS2015 and an Apache Cordova app. I want to send email via my app. I tried to make this but it didn't worked with me. I have add email - composer plugin from https://github.com/katzer/cordova-plugin-email-composer

Here is my code :

<div class="separator-fields"></div><a class="action-button" id="sendemail">Contact Us</a>

Here is my function :

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/framework.js"></script>
   <script>
    $("#sendemail") .click(function() {

        cordova.plugins.email.open({
            to: 'to email',
            cc: 'cc email',
            bcc: ['bcc email', 'bcc email'],
            subject: 'Greetings',
            body: 'How are you? Nice greetings from Leipzig'
        });
    });
</script>

but in my console log i have an error "Uncaught TypeError: Cannot read property 'plugins' of undefined"

Please advice .

2
any errors in the console? - OliverJ90
No there isn't any error - prime
I have updated my code please check. Thanx - prime
"Uncaught TypeError: Cannot read property 'plugins' of undefined" means cordova is not defined by the time you make that call... Where did you test your application? And have you checked if the deviceready event fired before calling your method like described in here? - Phonolog
I add this code : document.addEventListener('deviceready', function () { }, false); but the error still exist . - prime

2 Answers

0
votes

which platform and emulator/device are you using? you need to be sure that your code runs after the deviceready event.

0
votes

Use this javascript code, no need for any plugin

let Link="mailto:[email protected]?subject=Hello%20again";
    window.open(Link, "_system");