First you have to install it, the way plugins are installed by default in Cordova:
cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git
Next you check in your code if the corrog is enabled (so you do not give an error when you are viewing in the pc browser).
And then you use the isAvaible and open methods of the plugin in question
It would look something like this:
document.addEventListener('deviceready', function () {
if(window.cordova){
sendMail('teste', "[email protected]", "E aí fulano maluco, continua insano?");
}
}, false);
function sendMail(assunto, paraQuem, corpoDoEmail){
cordova.plugins.email.isAvailable(
function (isAvailable) {
if(!isAvailable){
return window.alert("Nao pode enviar email");
}
cordova.plugins.email.open({
to: paraQuem,
subject: assunto,
body: corpoDoEmail
});
}
);
}
This part of <gap:plugin name="cordova-plugin-email-composer" />
is automatically inserted with the cordova plugin add command I mentioned above. If you want to open a blank draft with no data filled in, simply call open without passing any parameters:
cordova.plugins.email.open();