/* steve jansen */

// another day in paradise hacking code and more

Update to the Cordova Email Plugin for iOS

| Comments

I put some serious TLC against the Cordova/PhoneGap plugin for creating email messages on iOS devices — v2.0 of the plugin now lives @ https://github.com/steve-jansen/cordova-ios-emailcomposer

You can give it a test drive with:

sudo npm install -g cordova
cordova create ~/MyApp MyApp
cd ~/MyApp
cordova platform add ios
cordova plugin add emailcomposer # using the http://plugins.cordova.io registry
cordova build
# manually update the www/index.html file to link to www/examples/EmailComposer.html
# run the app in the iOS 5.x+ simulator via Xcode

Major changes to the plugin include:

  • Support for file attachments using files paths, or file contents as encoded strings
  • Simpler JavaScript API
  • Support for cordova.require to load the plugin in JavaScript which means less global namespace pollution
  • Cordova 2.0+ plugin spec implemented (i.e., - (void) show:(CDVInvokedUrlCommand*)command)
  • ARC support
  • Ran git subtree to extract the history into a standalone repo, per the new Cordova plugin respository guidelines
  • Backwards compatibility with the JS API for the 1.x plugin
  • Backwards compatibility with the iOS/EmailComposerWithAttachments plugin
  • Jasmine unit tests for the JS part of the plugin
  • Xcode unit tests for the obj-c part of the plugin

I have a pull request to repoint phonegap-plugins/iOS/EmailCompser and phonegap-plugins/iOS/EmailCompserWithAttachments to this new repo. As a courtesy, I’ve asked the original contributors to these two plugins to give their blessing.

I’ve also published this plugin to the cordova npm-like repository. And, trust me, don’t call plugman publish with the --plugin argument.