Skip to content

This Cordova plugin allows to send an email using Android platform without email composer

License

Notifications You must be signed in to change notification settings

raguilera82/send-mail-cordova-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

send-mail-cordova-plugin

This Cordova plugin allows to send an email using Android platform without email composer

Add in Cordova/PhoneGap project

cordova plugin add https://github.com/raguilera82/send-mail-cordova-plugin.git

Example calling from index.js

  var app = {
  // Application Constructor
  initialize: function() {
      this.bindEvents();
  },
  // Bind Event Listeners
  //
  // Bind any events that are required on startup. Common events are:
  // 'load', 'deviceready', 'offline', and 'online'.
  bindEvents: function() {
      document.addEventListener('deviceready', this.onDeviceReady, false);
  },
  // deviceready Event Handler
  //
  // The scope of 'this' is the event. In order to call the 'receivedEvent'
  // function, we must explicity call 'app.receivedEvent(...);'
  onDeviceReady: function() {
      app.receivedEvent('deviceready');
      sendmail.send(app.sendMailSuccess, app.sendMailError,
              '(subject)',
              'body', 
              '[email protected]', 'password',
              '[email protected]');
  },
  sendMailSuccess : function() {
     console.log('Email send');
  },
  sendMailError : function(error) {
      console.log('Error: ' + error);
  },
  // Update DOM on a Received Event
  receivedEvent: function(id) {
      var parentElement = document.getElementById(id);
      var listeningElement = parentElement.querySelector('.listening');
      var receivedElement = parentElement.querySelector('.received');

      listeningElement.setAttribute('style', 'display:none;');
      receivedElement.setAttribute('style', 'display:block;');

      console.log('Received Event: ' + id);
  }
};

Tutorial in Spanish

http://www.adictosaltrabajo.com/tutoriales/tutoriales.php?pagina=PluginAndroidPhoneGap

About

This Cordova plugin allows to send an email using Android platform without email composer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published