Skip to content

AppGyver/email-composer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Email Composer with Attachments Plugin

Email Composer with Attachments allows for sending of emails with attachments. Modified from the original Phonegap plugin to accept attachment data directly from JavaScript, encoded in Base64.

Callable interface:

	window.plugins.emailComposer.showEmailComposerWithCallback(callback,subject,body,toRecipients,ccRecipients,bccRecipients,isHtml,attachments,attachmentsData);

Parameters:

  • callback: a js function that will receive return parameter from the plugin
  • subject: a string representing the subject of the email; can be null
  • body: a string representing the email body (could be HTML code, in this case set isHtml to true); can be null
  • toRecipients: a js array containing all the email addresses for TO field; can be null/empty
  • ccRecipients: a js array containing all the email addresses for CC field; can be null/empty
  • bccRecipients: a js array containing all the email addresses for BCC field; can be null/empty
  • isHtml: a bool value indicating if the body is HTML or plain text
  • attachments: a js array containing all full paths to the files you want to attach; can be null/empty
  • attachmentsData: a js array of fileName-fileData array pairs, e.g. [['filename1','base64data1'],['filename2','base64data2']]

Examples for attachement path:

Android //storage/emulated/0/cache/TEST_FILE.pdf

iOS cdvfile://localhost/persistent/cache/TEST_FILE.pdf

Callback return parameters

  • on iOS, a parameter is returned based on the status of the email:
    • Cancelled: "0"
    • Saved: "1"
    • Sent "2"
    • Failed "3"
    • Not Sent: "4"
  • On Android, there is no way to determine if the email was sent or not and thus the return parameter "2" is always returned.

Special thanks

I would like to say thanks to Guido Sabatini (https://github.com/phonegap/phonegap-plugins/blob/master/iOS/EmailComposerWithAttachments/) for the code we have (re)used and added extra functionalities to.

License

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 45.4%
  • Objective-C 45.0%
  • JavaScript 9.6%